So this script is supposed to give cash if you are in a certain group. However, it's not giving that cash. Can someone help me please?
Here's the script:
function onPlayerEntered(newPlayer)
if newPlayer:IsInGroup(0000000) then ----Replace the 0's with the actual group ID
newPlayer.leaderstats.Cash.Value = newPlayer.leaderstats.Cash.Value + 1000
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)

6 comments
You can't use PlayerAdded in localscripts.
I meant for the method :IsInGroup()
IsInGroup() doesn't need to be in a localscript..
I know but lets say they leave the group while they play the game, which no one would do, but if they did, the local script would automatically update.
Nevermind my last comment. I have a leaderboard up, and the script is not a localscript. Apparently, the script only works once, then doesn't work again.
If statements only run once unless there is a loop or a function being called.