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

'player' (a nil value) how do i fix that?

Asked by 6 years ago
Edited 6 years ago

local event = script.Parent.Parent:WaitForChild("RemoteEvent") local GrabPart = script.Parent.Parent local player = game.Players.LocalPlayer event.OnServerEvent:connect(function() local dad = Instance.new("Attachment",GrabPart) dad.Position = Vector3.new(0,1.201,0)

    local hand = game.Players.LocalPlayer.Character.LeftHand
    local dadd = Instance.new("Attachment",hand)
    dad.Position = Vector3.new(0,-0.1,0)

    local rod = Instance.new("RodConstraint",GrabPart)
    rod.Attachment0 = dad
    rod.Attachment1 = dadd
    rod.Length = 1
    GrabPart.CanCollide = false

    local holding = Instance.new("IntValue",GrabPart)
    holding.Name = "holding"
    holding.Value = 1

end)

Workspace.GrabPart.RemoteEvent.Grab:6: attempt to intex upvalue 'player' (a nil value) Stack Begin Script (Workspace.GrabPart.RemoteEvent.Grab', Line 6 Stack End

Plz help me fix the script.

1 answer

Log in to vote
1
Answered by 6 years ago

I saw you on the chat, You said you wern't using a local script. LocalPlayer Is only available in local scripts.

Ad

Answer this question