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

I have a 'NIL' value in my script. Help?

Asked by 4 years ago

I'm just confused since there clearly is the variable, but it's saying it's NIL? Okay, here's the error:

Workspace.Essential Scripts.Checkpoint Script:9: attempt to index local 'sl' (a nil value)

-

Here's the script.

function oa(object) local player = game.Players:playerFromCharacter(object) if player ~= nil then local ls = player.leaderstats local sl = game.Workspace:FindFirstChild(ls.Stage.Value) print("gah") object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0) wait() object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0) end end

function oe(object) if object.className == "Player" then local ack = Instance.new("IntValue") ack.Name = "leaderstats" local ack2 = Instance.new("IntValue") ack2.Name = "Stage" ack2.Value = 1 ack2.Parent = ack ack.Parent = object end end

game.Players.ChildAdded:connect(oe) game.Workspace.ChildAdded:connect(oa)

0
Could you reorganize the code in a code block so we can read it easier, please? cowsoncows 951 — 4y
0
please put it in lua form Creacoz 210 — 4y
0
playerFromCharacter is deprecated and no longer functions, instead use GetPlayerFromCharacter. Although it seems it wouldn't work here anyway, what exactly are you trying to get with it? Benbebop 1049 — 4y
0
I really don't know. This is just a free script. Dev_Azure -5 — 4y

Answer this question