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

why does it not change the value?!?!

Asked by
DJH_100 28
4 years ago

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
0
Also this is the what it said DJH_100 28 — 4y
0
is Owner a stringvalue? R_alatch 394 — 4y
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) DJH_100 28 — 4y
0
The PlrName was DJH_100 for the value DJH_100 28 — 4y
View all comments (4 more)
0
are you providing the whole script? line 7 has nothing to do with local Plr moo1210 587 — 4y
0
Yes Local CDP.Value is CDP = Plr.Leaderstats.CDP, DJH_100 28 — 4y
0
:? DJH_100 28 — 4y
0
Are the Owner and the Value was stringvalue? Xapelize 2658 — 4y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

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.

0
if this work please mark this as answer, if it wrong say the error below, Ill help too :P Xapelize 2658 — 4y
Ad

Answer this question