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

What wrong with that script? Line 3 attempt to index nil with 'WaitForChild

Asked by 4 years ago
Edited 4 years ago
script.Parent.Touched:Connect(function(part)
    local plr = game.Players:GetPlayerFromCharacter(part.Parent)
    local x = plr:WaitForChild("PlayerGui").MoneyGUI.lvl.lvl.Text
    if x == 1 then
        plr.Character:MoveTo(Vector3.new(43.11, 244.315, -140.64))
    end
end)

' 13:33:56.152 - Workspace.Part.Script:3: attempt to index nil with 'WaitForChild Its working without "if"

0
You dont need it, just plr.PlayerGui and it will work WoTrox 345 — 4y
0
i have already tried that. it won't work DilanALX12345678901 7 — 4y

Answer this question