script.Parent.MouseButton1Down:connect(function()
	
		local playername = player.Name
		local playerstats = game.Players[playername].leaderstats
		
		playerstats.Level.Value = playerstats.Level.Value + 1
		playerstats.Points.Value = playerstats.Points.Value + 43
		playerstats.XP.Value = playerstats.XP.Value + 58
end)


In studio, this script works fine, it changed my leaderstats to the values, but when I play the game(not in studio), it gives me this error: "attempt to index global 'player' (a nil value)" on line 3. Help?

1 comment

0

What type of script are you using and how are you finding the player?