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!