I am making a leaderboard for the number of times people ride roller coasters in my game, and I am trying to add a way to give players badges when they reach a certain level. The levels I am going to add are 50, 100, 200, 300, but I can't even get the first one to work.
Code:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Coasters = Instance.new("IntValue")
Coasters.Name = "Coasters"
Coasters.Parent = leaderstats
local BadgeService = game:GetService("BadgeService")
local badgeid = --BadgeID Here
Coasters:GetPropertyChangedSignal("Value"):Connect(function(value)
if value >= 50 then
BadgeService:AwardBadge(badgeid)
end
end)
end)

2 comments
I am also beginner and I dont know if this is case but this will award badge after it becomes 51 because of >=
No because of >= means if it's 50 or above 50 then it's good