jjadtru
(Jad)
June 25, 2021, 6:28pm
#1
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
jjadtru
(Jad)
June 25, 2021, 6:31pm
#3
Pokemoncraft5290:
variable player
the player that presses the button
1 Like
Winbloo
(Winbloo)
June 25, 2021, 6:35pm
#4
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
jjadtru
(Jad)
June 25, 2021, 6:37pm
#5
I now realize what I did wrong
2 Likes
jjadtru
(Jad)
June 25, 2021, 6:38pm
#6
I only called the local player and not the leaderstats
1 Like