-
I want my Dash script to not cause the flying issue in this video
-
When dashing into a small object or object with unusual curves it sends the player up
-
Tried messing with the BV values to no avail
This is a server Script
local char = script.Parent.Parent
local hum = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local SideGyro = Instance.new("BodyGyro")
SideGyro.MaxTorque = Vector3.new(3e5,0,3e5)
SideGyro.P = 5e5
SideGyro.Parent = hrp
local DashSpeedPerm = 65
local DashSpeed = 65
local DashLength = 8
local sideDashCooldown = 0.75
local pivitalDashCooldown = 1.25
local sideDebounce = false
local pivitalDebounce = false
-- STATES
local dashing = char:WaitForChild("STATES"):WaitForChild("Movement"):WaitForChild("Dashing")
local Animations = {
["DashRight"] = 'rbxassetid://135911084922934';
["DashLeft"] = 'rbxassetid://81447650120538';
["DashFront"] = 'rbxassetid://113320811106767';
["DashBack"] = 'rbxassetid://131062322489558';
}
for i,v in pairs(Animations) do
local Anim = Instance.new("Animation")
Anim.AnimationId = v
Anim = hum:LoadAnimation(Anim)
Animations[i] = Anim
end
script.Dash.OnServerEvent:Connect(function(plr, Key)
local dashSFX = plr.PlayerGui.SFX.Movement.Dash
local landSFX = plr.PlayerGui.SFX.Movement.LandLight
if dashing.Value then
return
end
local DashAnim
local Front
local Side
local typeDash
local cancel
if Key == Enum.KeyCode.A then
if sideDebounce then return end
typeDash = "Side"
Side=-1.65
Front = 0
DashAnim = "Left"
end
if Key == Enum.KeyCode.D then
if sideDebounce then return end
typeDash = "Side"
Side=1.65
Front = 0
DashAnim = "Right"
end
if Key == Enum.KeyCode.W then
if pivitalDebounce then return end
typeDash = "Pivital"
Side=0
Front = 2
DashAnim = "Front"
end
if Key == Enum.KeyCode.S then
if pivitalDebounce then return end
typeDash = "Pivital"
Side=0
Front = -1.85
DashAnim = "Back"
end
if typeDash == "Side" then
sideDebounce = true
else
pivitalDebounce = true
end
dashing.Value = true
DashSpeed = DashSpeedPerm
local cloneSFX = dashSFX:Clone()
cloneSFX.Parent = char.HumanoidRootPart
cloneSFX:Play()
game.Debris:AddItem(cloneSFX, cloneSFX.TimeLength)
dashing.Value = true
Animations["Dash"..DashAnim]:Play()
hum.WalkSpeed = 0
task.wait(0.1)
local DashVelocity = Instance.new("BodyVelocity")
DashVelocity.MaxForce = Vector3.new(math.huge,0,math.huge)
DashVelocity.P = 9e9
DashVelocity.Parent = hrp
DashVelocity.Velocity = hrp.CFrame.LookVector * (Front * DashSpeed) + hrp.CFrame.RightVector * (Side * DashSpeed)
local count = 0
local negatingFactor = DashSpeedPerm/(DashLength)
repeat wait()
DashVelocity.Velocity = hrp.CFrame.LookVector * (Front * DashSpeed) + hrp.CFrame.RightVector * (Side * DashSpeed)
count += 1
if DashSpeed ~= 0 and DashSpeed > 0 then
DashSpeed -= negatingFactor
end
until count >= DashLength
landSFX:Play()
hum.WalkSpeed = 13
dashing.Value = false
DashVelocity:Destroy()
if typeDash == "Side" then
task.wait(sideDashCooldown)
sideDebounce = false
else
task.wait(pivitalDashCooldown)
pivitalDebounce = false
end
end)
I was thinking of using raycast to see if there is an object where the player is dashing, but I’m not sure if it is viable