I’m trying to make a Slide System using LinearVelocity since BodyVelocity is deprecated, everything was going well until I ran into a problem. everytime near the end the players character sort of rotate to the right. I’ve tried doing everything to solve this on my own & search for similar issues but still nothing.
The script I made
-- Function
SlideAbility = function()
-- Settings
Humanoid.WalkSpeed = 0
Humanoid.AutoRotate = false
-- Animation
local SlideTrack = Humanoid:LoadAnimation(SlideAnimation)
SlideTrack.Priority = Enum.AnimationPriority.Action
SlideTrack:Play()
-- Attachment Settings
local Attachment = Instance.new("Attachment") -- Creates an attachment
Attachment.Parent = RootPart -- Attaches the attachment to the player's root part
Attachment.WorldPosition = RootPart.AssemblyCenterOfMass
-- LinearVelocity Settings
local Velocity = Instance.new("LinearVelocity")
Velocity.MaxForce = 10000 -- The force of the LinearVelocity
Velocity.Attachment0 = Attachment -- Attaches the LinearVelocity to the player's root part
Velocity.RelativeTo = Enum.ActuatorRelativeTo.World -- Makes it so the LinearVelocity does not use person getting up as direction starting point
Velocity.VectorVelocity = RootPart.CFrame.LookVector * SlideInfo.Speed -- The direction and speed of the LinearVelocity
Velocity.Parent = RootPart -- Attaches the LinearVelocity to the player's root part
for Count = 1,8 do -- This loop will make the player slide for a certain amount of time
task.wait(.1) -- The amount of time the player will slide for
Velocity.LineVelocity *= 0.7 -- The speed of the player sliding
end
Velocity:Destroy()
Attachment:Destroy()
SlideTrack:Stop()
Humanoid.WalkSpeed = 0
Humanoid.AutoRotate = true
end