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

Attempt to index a nil value?

Asked by 9 years ago

I am trying to make a Group Rank seat but I keep getting this error on line 7: Workspace.VehicleSeat.Script:7: attempt to index a nil value. Can anyone tell me how to fix this?

Here is the code:

local id = 123
local rid = 5

script.Parent.ChildAdded:connect(function(player)
    if player:IsA("Weld") then
        print("Is a weld")
        if game:GetService("Players"):FindFirstChild(player.Parent.Name):GetRoleInGroup(id) < rid then
            print(player.Parent.Name "is not "..rid.."in "..id)
            player.Parent.Parent.Humanoid.Jump = true
        else
            print(player.Parent.Name "is "..rid.."in "..id)
        end
    end
end)

Answer this question