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

I am trying to make a part dissapear at 1 less points can anyone help?

Asked by
WN0820 11
4 years ago

So I get this error saying

10:20:57.641 - Workspace.Unlock:3: attempt to index local 'leaderstats' (a nil value)

I am not sure why this happens I tried using everything I could, but I couldn't figure it out here is the script

local plr = script.Parent.Parent
local leaderstats = plr:FindFirstChild("leaderstats")
local Points = leaderstats:FindFirstChild("Points")
local Part = game.Workspace.Part


if Points.Value < 1 then
    Part.Transparency = 1
end

If you can help me thanks

0
I'd try changing the "FindFirstChild" at line 2 to a "WaitForChild" Lamantinel -1 — 4y
0
I agree with Lamantinel, as this code may run faster than when the game creates the leaderstats for the player. killerbrenden 1537 — 4y

Answer this question