I want to achieve a deepwoken-like dodge, where the character gets propelled in the direction it’s going
The issue is, ~50% of the time the character gets sent to the void and deleted? I tried looking on devforum, but couldn’t find anything.
I tried changing it to VectorForce, but it stopped working whatsoever.
Here’s the dodge part of the script:
Remotes.Combat.Dodge.OnServerEvent:Connect(function(plr)
local char = plr.Character
local Humanoid:Humanoid = char.Humanoid
local HRP = char.HumanoidRootPart
if char:GetAttribute("DodgeCooldown") == true then
return
end
local attachment = Instance.new("Attachment")
attachment.Parent = HRP
local velocity = Instance.new("LinearVelocity")
velocity.Parent = HRP
velocity.Attachment0 = attachment
velocity.MaxForce = 10000
char:SetAttribute("DodgeCooldown",true)
char:SetAttribute("Dodging",true)
if Humanoid.FloorMaterial == Enum.Material.Air then -- The thing that is probably causing this
-- later
else
local i = 0
repeat task.wait(0.05)
i += 1
velocity.VectorVelocity = Vector3.new(Humanoid.MoveDirection.Unit.X,0,Humanoid.MoveDirection.Unit.Z) * 45
until i == 10
end
velocity:Destroy()
char:SetAttribute("Dodging",false)
local cor = coroutine.create(function()
task.wait(1.25)
char:SetAttribute("DodgeCooldown",false)
end)
coroutine.resume(cor)
end)
And a video of the issue:
(I’m pressing the dodge button on this one, couldn’t find a decent keyboard visualizer)
(sorry for the goofy video size)
This is how it’s supposed to work: