- What do you want to achieve?
i want to achieve a dash like this (or a near one):
Not getting stucked in the wall
- What is the issue?
My dashes are to buggy and “forced”, the Jujutsu shenanigans
one is very soft.
I dont know what is good for dashes (Body velocity, linear velocity, apply impulse, or tweening)
and my dash get a little boost and can get stuck when i dash to a wall
- What solutions have you tried so far?
i searched, but i didnt find something that help me rather than using raycasts but i dont think that is the solution for “battlegrounds type dash” (i think).
THIS IS MY CODE:
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local hrp : Part = chr:WaitForChild("HumanoidRootPart")
local hum : Humanoid = chr:WaitForChild("Humanoid")
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local gameSettings = UserSettings().GameSettings
local indicator = Instance.new("Highlight")
indicator.Parent = chr
indicator.FillColor = Color3.fromRGB(255, 0, 0)
indicator.DepthMode = Enum.HighlightDepthMode.Occluded
function LV()
local lv = Instance.new("LinearVelocity")
lv.RelativeTo = Enum.ActuatorRelativeTo.World
lv.Attachment0 = hrp.RootAttachment
lv.ForceLimitsEnabled = true
lv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
lv.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
lv.MaxAxesForce = Vector3.new(1, 0, 1) * 100000
lv.Parent = hrp
return lv
end
local db = false
local type = {
frontdash = {
time = 0.4,
velocity = 50,
iteration = 200,
min = 40 * 0,
},
sidedash = {
time = 0.05,
velocity = 60,
iteration = 150,
min = 40 * 0.15,
}
}
function dash()
local pressedkey = nil
if db then
return
end
db = true
local lv = LV()
print("Dashing")
local connection : RBXScriptSignal
hum.WalkSpeed = .1
hum.JumpPower = 0
indicator.FillColor = Color3.fromRGB(0, 255, 0)
local typ = type.sidedash
gameSettings.RotationType = Enum.RotationType.CameraRelative
if UIS:IsKeyDown(Enum.KeyCode.W) or hum.MoveDirection == Vector3.zero then
pressedkey = "W"
typ = type.frontdash
gameSettings.RotationType = Enum.RotationType.MovementRelative
elseif UIS:IsKeyDown(Enum.KeyCode.S) then
pressedkey = "S"
elseif UIS:IsKeyDown(Enum.KeyCode.D) then
pressedkey = "D"
elseif UIS:IsKeyDown(Enum.KeyCode.A) then
pressedkey = "A"
end
local tic = tick()
local velo = typ.velocity
connection = RS.PostSimulation:Connect(function(dt)
if (tick() - tic) >= typ.time then
velo -= typ.iteration * dt
end
local md = hrp.CFrame.LookVector
if pressedkey == "S" then
md = -hrp.CFrame.LookVector
elseif pressedkey == "D" then
md = hrp.CFrame.RightVector
elseif pressedkey == "A" then
md = -hrp.CFrame.RightVector
end
lv.VectorVelocity = md * velo
if velo <= typ.min then
lv:Destroy()
indicator.FillColor = Color3.fromRGB(255, 0, 0)
db = false
print("Stop Dashing")
connection:Disconnect()
gameSettings.RotationType = Enum.RotationType.MovementRelative
hum.WalkSpeed = 16
hum.JumpPower = 40
end
end)
end
UIS.InputBegan:Connect(function(input, _)
if input.KeyCode == Enum.KeyCode.Q then
dash()
end
end)