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

My player won't sit when touching a part?

My player won't sit when touching a part(More specifically a union).

Here's the code:

script.Parent.Touched:Connect(function(hit)
	game:GetService("Players").LocalPlayer.Humanoid.Sit = true
end)

Can someone explain this issue? Thanks if you can.

1 answer

✓ Accepted answer

LocalPlayer is only used for local scripts , game:GetService("Players") isn't necessary.

If you want the script to work then try this:

script.Parent.Touched:Connect(function(hit)	     
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent:FindFirstChild("Humanoid").Sit=true
	end	
end)

hit.parent is basically the player who touched it.

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