For some reason, these dash animations look way off than how they’re supposed to. I don’t believe its because of the script itself and this is a new place with no other scripts. All of the animation ids are correct, and all of the priorities are Action2. Here’s how its supposed to look:
and heres how it looks in studio:
this is my code:
local debris = game:GetService("Debris")
local char = script.Parent
local hum = char.Humanoid
local humRoot = char:WaitForChild("HumanoidRootPart")
local dashDeb = false
local vars = {
DASH_DISTANCE = 20,
DASH_CD = 0.5
}
local forwarddash = false
local leftdash = false
local rightdash = false
local backdash = false
local animdashfwd = hum:LoadAnimation(script.dashforward)
local animdashright = hum:LoadAnimation(script.dashright)
local animdashleft =hum:LoadAnimation(script.dashleft)
local animdashback =hum:LoadAnimation(script.dashback)
-- dashing
uis.InputBegan:Connect(function(input,isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.Q and dashDeb == false then
if forwarddash == true or leftdash == true or rightdash == true or backdash == true then
dashDeb = true
if forwarddash == true then
animdashfwd:Play()
end
if rightdash == true then
animdashright:Play()
end
if leftdash == true then
animdashleft:Play()
end
if backdash == true then
animdashback:Play()
end
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {char,workspace.Baseplate}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local rayResult = workspace:Raycast(humRoot.Position,hum.MoveDirection * vars.DASH_DISTANCE,raycastParams)
local rayPos
if rayResult then
local part = rayResult.Instance
if part.CanCollide == true then
rayPos = rayResult.Position
else
rayPos = (humRoot.CFrame + (hum.MoveDirection * vars.DASH_DISTANCE)).Position
end
else
rayPos = (humRoot.CFrame + (hum.MoveDirection * vars.DASH_DISTANCE)).Position
end
local mover = Instance.new("BodyPosition",humRoot)
mover.MaxForce = Vector3.new(9999999,9999999,9999999)
mover.D = 100
mover.P = 1000
mover.Position = rayPos
debris:AddItem(mover,0.3)
local gyro = Instance.new("BodyGyro",humRoot)
gyro.MaxTorque = Vector3.new(9999999,9999999,9999999)
gyro.D = 100
gyro.P = 1000
gyro.CFrame = humRoot.CFrame
debris:AddItem(gyro,0.3)
spawn(function()
wait(vars.DASH_CD)
dashDeb = false
end)
end
end
if input.KeyCode == Enum.KeyCode.W then
forwarddash = true
end
if input.KeyCode == Enum.KeyCode.A then
leftdash = true
end
if input.KeyCode == Enum.KeyCode.S then
backdash = true
end
if input.KeyCode == Enum.KeyCode.D then
rightdash = true
end
end) ```