Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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 comment

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.