My script is not working

I’m trying to make a script that gives people money after they redeem a code and its not working

this is the script(Btw this is not all of the script its just the part that is giving problems)

local success,err = pcall(Datastore.UpdateAsync,Datastore,Player_ID,function(old)
				player.leaderstats.Void.Value += 500

This is what it says in the output

Players.JadtrugamingYT1.PlayerGui.CodeGui.MainFrame.Redeem.RedeemScript:38: attempt to index nil with 'leaderstats'
2 Likes

What is the variable player?

2 Likes

the player that presses the button

1 Like

player is returned as “nil”, you’re probably getting the player incorrectly, you should show the part of code where it gets the player so we can analyze your problem.

1 Like

I now realize what I did wrong

2 Likes

I only called the local player and not the leaderstats

1 Like