I'm trying to make it to were every 10 seconds you get 5 credits. works in studio but not in game... Everything works fine but the adding cash at the bottom of the script. Any idea on how to make it work?
function CreateStats(NewPlayer)
local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
leaderstats.Value = 0
local Credits = Instance.new("IntValue")
Credits.Name = "Credits"
Credits.Value = 50
Credits.Parent = leaderstats
leaderstats.Parent = NewPlayer
return leaderstats
end
game.Players.ChildAdded:connect(CreateStats)
while true do
wait(10)
game.Players.LocalPlayer.leaderstats.Credits.Value = game.Players.LocalPlayer.leaderstats.Credits.Value + 5
end

1 comment
LocalPlayer can only be used in a LocalScript