Stop player from rotating in all directions

Hey developers!

I’ve been working on a parachute system. Whenever a character touches the gate, it teleports in the middle of it. An AlignPosition is then applied to make the player always go forward. The problem is, sometimes the player starts rotating like crazy. Here is a video:

I can’t anchor the HumanoidRootPart, because else the AlignPosition won’t work and the player will just stay in the middle of the gate.

AutoRotate is also set to false.

CODE:

Gate.Touched:Connect(function(hit)

	-- more code

	HumanoidRootPart.CFrame = Gate.CFrame * CFrame.Angles(0,math.rad(180), 0) -- teleport player in the middle of the gate

	local newattach = Instance.new("Attachment")
	newattach.Name = "AP"
	newattach.Parent = HumanoidRootPart

	local newAp = Instance.new("AlignPosition")
	newAp.Name = "AlignPosition"
	newAp.Attachment0 = newattach
	newAp.MaxForce = 1000000
	newAp.Mode = Enum.PositionAlignmentMode.OneAttachment
	newAp.Parent = HumanoidRootPart

	RunService.Heartbeat:Connect(function(dt)
		task.wait()
		local parachuteSpeed = profile.Data.ParachutePoints + (equippedParachute.xSpeed*200)
		newAp.Position = HumanoidRootPart.Position + Vector3.new(0,-1,1 + (parachuteSpeed/(5 + RaceConfig.ParachuteDecrease))) * dt
	end)

end)

Note that whenever i jump before touching the part, it doesn’t happen.

Any help is appreciated!

1 Like

Did utilizing AlignOrientation not work for this parachute system? I think it might be worth a try.
Use it alongside your AlignPosition, and i think it would fix the player spazzing out

1 Like

No idea why I didn’t think about using AlignOrientation. Thanks for pointing it out, it works perfectly!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.