Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change IntValue using a script?

Asked by 3 years ago
Edited 3 years ago

I was wondering how to change the value of an IntValue using a script but it isn't working. I am trying to make a currency system. Here is the code I have (new to scripting in Roblox): `local playerdata = game.Players.LocalPlayer:WaitForChild("leaderstats")

if playerdata.Coins.Value == 0 then
    playerdata.Coins.Value = 20000

end`

2 answers

Log in to vote
0
Answered by 3 years ago

Your code should work only if the Value of Coins is 0.

0
are you getting any errors cause that codes should work TheMiniMagic_YT 27 — 3y
0
Did you made the leaderstats and coins JustinWe12 723 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

@JustinWe12 The value of my coins is set to 0, and my error for anyone else is "ServerScriptService.Script:1: attempt to index nil with 'WaitForChild' - Server - Script:1"

Any other ideas?

0
You Idiot Send The Whole Script kidsteve923 139 — 3y
0
Wow, how rude, I sent the script in my first post, go to school for once in your life Zayaa_n 0 — 3y

Answer this question