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)
game.Players.PlayerAdded:connect(function(newPlayer) if newPlayer:IsInGroup(0000000) then ----Replace the 0's with the actual group ID local leaderboard = Instance.new("IntValue", newPlayer) leaderboard.Name = "leaderstats" local Cash = Instace.new("IntValue") Cash.Value = Cash.Value + 1000 Cash.Parent = leaderboard Cash.Name = "Cash" end end)
Maybe the problem is that leaderboard and cash doesn't exist? Maybe check your output incase this is just a part of a script. Also use a local script for the method :IsInGroup()
because If someone leaves the group in-game (why would they?) then it would automatically update.