So i want to make a game, it has saving progress but i dont know how do i make adding gold beacuse when i put this script to brick:
function addGOLD()
game.Players.LocalPlayer.leaderstats.Gold.Value += 25
end
script.Parent.Touched:Connect(addGOLD)
it shows:
09:34:01.855 Workspace.Part.Script:2: attempt to index nil with 'leaderstats' - Server - Script:2
09:34:01.855 Stack Begin - Studio
09:34:01.855 Script 'Workspace.Part.Script', Line 2 - function addGOLD - Studio - Script:2
09:34:01.855 Stack End - Studio
but when i type this in command bar:
game.Players.LocalPlayer.leaderstats.Gold.Value += 25
it works, so wheres the problem?

1 comment
Is this a server script?