|
| 10 Jan 2017 05:40 PM |
local BID = 607126916 -- local BS = game:GetService("BadgeService")
game.Players.PlayerAdded:connect(function(plr) plr = game.Players:FindFirstChild(plr.Name) plr.leaderstats.Wins.Changed:connect(function() if plr.leaderstats.Wins >= 50 then BS:AwardBadge(plr.userId, BID) end end) end)
They have a leaderstats with wins, and when it gets over 50 or to 50, I want it so they get the badge. I've tested it online, and there isn't a popup in the game that it has that tells me "you got this badge" or whatever. I tested it yesterday, and in the badges stats it says "gotten yesterday: 0". Anyone know whats wrong with this? Or will it work with other players |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 05:48 PM |
why are you doing plr = game.Players:FindFirstChild(plr.Name)
the event already gives u the player object you also have to keep in mind that leaderstats could potentially not be there before the .Changed event is used on it, so you should wait for leaderstats and the "Wins".
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 05:50 PM |
So this?
local BID = 607126916 local BS = game:GetService("BadgeService")
game.Players.PlayerAdded:connect(function(plr) ldrstats = plr:WaitForChild("leaderstats") wins = ldrstats:WaitForChild("Wins") wins.Changed:connect(function() if plr.leaderstats.Wins >= 50 then BS:AwardBadge(plr.userId, BID) end end) end) |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 05:51 PM |
ya
use .UserId instead of .userId
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|