Trying to make a dash system for my battlegrounds game. Everything works perfectly expect one thing - when you using the dash against a wall, you starting getting up against it.
Also somehow, the dashes that going in left or right directions won’t fling you, but the dash forward and back will fling you
Here’s the part of the code that creates LinearVelocity:
function CreateVelocity(TweenLength, Length, Force, HumanoidRootPart)
local Attachment = Instance.new("Attachment", HumanoidRootPart)
Attachment.WorldPosition = HumanoidRootPart.AssemblyCenterOfMass
Attachment.Name = "VelocityAttach"
local Velocity = Instance.new("LinearVelocity", HumanoidRootPart)
Velocity.ForceLimitsEnabled = true
Velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
Velocity.MaxAxesForce = Vector3.new(100000, 0, 100000)
Velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
Velocity.Attachment0 = Attachment
Velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
Velocity.VectorVelocity = Force
TweenService:Create(Velocity, TweenInfo.new(TweenLength, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {VectorVelocity = Vector3.new(0, 0, 0)}):Play()
coroutine.wrap(function()
task.wait(Length)
if Velocity and Attachment then
Velocity:Destroy()
Attachment:Destroy()
end
end)()
end
And here are the directions of dashes (VectorVelocity):
local Directions = {
["Enum.KeyCode.W"] = Vector3.new(0, 0, -100),
["Enum.KeyCode.A"] = Vector3.new(-100, 0, 0),
["Enum.KeyCode.S"] = Vector3.new(0, 0, 100),
["Enum.KeyCode.D"] = Vector3.new(100, 0, 0),
}
Is there anyway to make it work like in other battlegrounds games? “The Strongest Battlegrounds” for example.