Hi! Im making dash system and when im dashing into part or other character i am fling yourself, how to fix that?
local function Dash(Player, Direction, dashAnim)
local Character = Player.Character
local Humanoid = Character:FindFirstChild('Humanoid'):: Humanoid
local Velocity = Instance.new('LinearVelocity')
Velocity.Parent = Character.HumanoidRootPart
Velocity.MaxForce = math.huge
Velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
Velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
local Attachment = Instance.new('Attachment')
Attachment.Parent = Character.HumanoidRootPart
Velocity.Attachment0 = Attachment
local Anim = Humanoid:LoadAnimation(dashAnim)
Anim:Play()
RemoteEvents.Dash:FireClient(Player, true)
if Direction == 'Front' then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
Velocity.VectorVelocity = Vector3.new(0, -10, -65)
else
Velocity.VectorVelocity = Vector3.new(0, 4, -65)
end
elseif Direction == 'Right' then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
Velocity.VectorVelocity = Vector3.new(65, -10, 0)
else
Velocity.VectorVelocity = Vector3.new(65, 4, 0)
end
elseif Direction == 'Left' then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
Velocity.VectorVelocity = Vector3.new(-65, -10, 0)
else
Velocity.VectorVelocity = Vector3.new(-65, 4, 0)
end
elseif Direction == 'Back' then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
Velocity.VectorVelocity = Vector3.new(0, -10, 65)
else
Velocity.VectorVelocity = Vector3.new(0, 4, 65)
end
end
game.Debris:AddItem(Attachment, 0.3)
game.Debris:AddItem(Velocity, 0.3)
task.wait(0.5)
RemoteEvents.Dash:FireClient(Player, false)
end