Hi, i was wondering if someone could help me with a Script that awards a badge when the player has achieved the required amount of cash. All scripts i can find seem to be outdated and do not work. This is the script i use which doesnt work
local BadgeID = 2124473380 --Badge ID Here
local Cash = "Cash" --Change Money To The Stat
local HowMuch = 100000000 --Change To How Much They Need To Have
game.Players.PlayerAdded:connect(function(p)
repeat wait() until p:findFirstChild("leaderstats") ~= nil
p.leaderstats[Cash].Changed:connect(function()
if p.leaderstats[Cash].Value <= HowMuch - 1 then return end
game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID)
end)
end)

7 comments
There is nothing wrong with this script, are there any errors? Where are you placing the script? Is it a regular script?
Is is a regular script placed in workspace and it doesnt seem to show that there are any errors, it just doesn't give me badge
@EpikLevel Have you tried on another account, if you already own the badge obviously you won't see it awarded to your self. Try adding a print() because it awards the player to see if it runs, if so you have nothing to worry about.
Yeah it doesnt seem to work on other accounts
@EpikLevel The script is working perfectly for me, if changing userId to UserId doesn't work then the problem is somewhere else.
Why [Cash]? Just use .Cash, it's literally the same name, why have a variable that contains the name, only to use it in place of syntactic sugar a.b that's like so pointless
Yeah it still doesnt work, my only guess is because the game is on a group