Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why does it not change the value?!?!

I cant get it to work

local PlrName = script.Parent.Parent.Parent.Owner.Value
print(PlrName)
local Plr = game.Players:FindFirstChild(PlrName)
print(Plr)
local CDP = Plr.leaderstats.CDP
local amount = 3
CDP.Value = CDP.Value + amount

8 comments

0

Also this is the what it said

0

is Owner a stringvalue?

0

Yes 19:15:16.491 - Workspace.Zednov's Tycoon Kit.Tycoons.Factory.PurchasedObjects.DropperDirt.DropperScript:7: attempt to index local 'Plr' (a nil value)

0

The PlrName was DJH_100 for the value

0

are you providing the whole script? line 7 has nothing to do with local Plr

0

Yes Local CDP.Value is CDP = Plr.Leaderstats.CDP,

0

:?

0

Are the Owner and the Value was stringvalue?

1 answer

change line 5 to this (i guess):

local CDP = Plr:WaitForChild("leaderstats").CDP

before the player spawned, they need to insert the leaderstats inside.

So if you instantly check the leaderstats, they will get an error to you.

1 comment

0

if this work please mark this as answer, if it wrong say the error below, Ill help too :P

This discussion is preserved as it was. New answers, comments, and votes are closed.