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 7 years ago
Edited 7 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)

01local hand = game.Players.LocalPlayer.Character.LeftHand
02local dadd = Instance.new("Attachment",hand)
03dad.Position = Vector3.new(0,-0.1,0)
04 
05local rod = Instance.new("RodConstraint",GrabPart)
06rod.Attachment0 = dad
07rod.Attachment1 = dadd
08rod.Length = 1
09GrabPart.CanCollide = false
10 
11local holding = Instance.new("IntValue",GrabPart)
12holding.Name = "holding"
13holding.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 7 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