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

Forcing player to sit in a seat?

I'm making a racing game, and I want to force players to sit in a seat. The problem is not to make them stay in the seat, but making them automatically sit. As teleporting the player would be buggy, that's not a solution. What else would work?

2 answers

✓ Accepted answer

A player sitting down is in fact just the game creating a weld between the player's Torso and the seat, as well as bending the limbs 90 degrees forward.

So there are 2 things you need to do: -Weld the torso relative to the seat so that the player appears to be seated. -Edit the DesiredAngle of the Motor6Ds for the limbs that are found under Torso so that the limbs bend 90 degrees forward.

There you go.

1 comment

0

I do not know how to edit the DesiredAngle to make the legs bend 90 degrees, any code?

Okay, I figured it out myself.

For any other users that want to know, here's the code:

script.Parent.Touched:connect(function(Hit)
	local Char = Hit.Parent
	if Char:FindFirstChild("Humanoid") then
		local W = Instance.new("Weld", script.Parent)
		W.Part0 = W.Parent
		W.Part1 = Char.HumanoidRootPart
		W.C0 = CFrame.new(0, 0.5, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
		W.C1 = CFrame.new(0, -1.5, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
		Char.Humanoid.Sit = true
	end
end)

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