PointsService

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

ไม่สามารถสร้าง
บริการ
เลิกใช้แล้ว

คลาส PointsService ควบคุมจุด

แต้มเป็นระบบรางวัลที่ใช้แสดงความสำเร็จและการมีส่วนร่วมของผู้เล่นทั่ว Robloxวิธีที่จะได้รับแต้มผ่านบริการนี้ขึ้นอยู่กับดุลยพินิจของผู้พัฒนาเกม

สรุป

อีเวนต์

  • PointsAwarded(userId : number,pointsAwarded : number,userBalanceInGame : number,userTotalBalance : number):RBXScriptSignal

    จะเกิดไฟไหม้เมื่อจุดได้รับรางวัลสําเร็จให้กับผู้เล่นในขณะที่ยังส่งต่อความสมดุลที่ปรับปรุงแล้วของจุดที่ผู้เล่นมีในเกมปัจจุบันและในเกมทั้งหมด

คุณสมบัติ

วิธีการ

อีเวนต์

PointsAwarded

อีเวนต์นี้จะเกิดขึ้นเมื่อจุดได้รับรางวัลสําเร็จแก่ผู้เล่นในขณะที่ยังส่งต่อความสมดุลที่ปรับปรุงแล้วของจุดที่ผู้เล่นมีในเกมปัจจุบันและในเกมทั้งหมด

เมื่อผู้เล่นได้รับคะแนนสําเร็จตัวอย่างด้านล่างจะพิมพ์รหัสผู้ใช้และยอดคงเหลือจุดใหม่หากบัญชี Roblox ได้รับคะแนนสามสิบแต้ม (และไม่มีอะไรเริ่มต้นด้วย)

ผู้ใช้: 1 ได้รับ 30 (+30) คะแนนในเกมปัจจุบันแล้ว ตอนนี้ทำให้ยอดคงเหลือรวมของพวกเขา

จะถูกพิมพ์


local function pointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print("User: " .. userId .. " has now earned " .. userBalanceInGame .. " (+" .. pointsAwarded ..") points in the current game, now making their total balance " .. userTotalBalance)
end
game:GetService("PointsService").PointsAwarded:Connect(pointsAwarded)

พารามิเตอร์

userId: number
pointsAwarded: number
userBalanceInGame: number
userTotalBalance: number

ตัวอย่างโค้ด

When a player is awarded points successfully the below example would print the userId and their new point balance. If, for example, the Roblox account was awarded thirty points (and had none to begin with) "User: 1 has now earned 30 (+30) points in the current game, now making their total balance 30" would be printed.

PointsService.PointsAwarded

local PointsService = game:GetService("PointsService")
local function onPointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print(
"User:",
userId,
"has now earned",
userBalanceInGame,
"(+",
pointsAwarded,
") points in the current game, now making their total balance",
userTotalBalance
)
end
PointsService.PointsAwarded:Connect(onPointsAwarded)