function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local c = Instance.new("IntValue")
c.Name = "Cash"
c.Value = 20
c.Parent = stats
stats.Parent = newPlayer
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
COMMUNITY QUESTION
Output shows that line 15 is an error, should I delete line 15? would it affect the script?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Where is the function onPlayerRespawned defined????
in addition to what zamd said :connect() is deprecated, use :Connect(). onPlayerRespawned is what I'm assuming happens to a player when they respawn, so you'd need to define that. If you you don't want that, remove the player.Changed event call.