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

local variable = workspace:FindFirstChild(local variable) returns as workspace?

Asked by 9 years ago

I made a scrip, it has four local variables. When it runs the third local variable, and prints the name of it, it returns as Workspace?!?!? Why? Can I fix that? Here is my script

wait(1)
script.Parent.Equipped:connect(function(mouse)
    mouse.Button1Down:connect(function()
    local animation = script.Slash

    print("loading")
    local plyr = script.Parent.Parent.Parent.Name
    print(plyr)
    local char = workspace:FindFirstChild(plyr) --here is local variable #3
    print(char.Name)
    local anim = char.Humanoid:LoadAnimation(animation)
    print("done")
    end)
end)

Output1(print): Workspace------------------------------------------------------------------------- Output2:(error)Players.Player.Backpack.Tool.Script:10: attempt to index local 'char' (a nil value) Please help!!! Thank you!!!

Answer this question