So basically i have this dash system that adds an attachment and linear velocity inside to the players humanoidrootpart for a split second and then deletes it.
It works for the most part, however there are 3 issues:
dash distance on the ground and mid air being VERY different (can technically be fixed by not letting the player dash mid air but thats lame)
bumping into walls could ragdoll or even fling the player
gravity doesnt affect the player for the split second linear velocity is active for
I tried looking for answers but most of them dont use linear velocity (i use it cause i was told its the best for dashes)
Any ideas on how to fix these? Any help would be greatly appreciated
I tried looking for answers but most of them dont use linear velocity (i use it cause i was told its the best for dashes)
Not really, maybe in some cases, but you’re generally better off setting the humanoidrootpart’s velocity.
Untested code, might be syntax errors, but i trust you get the idea.
(Also, this only does a right dash)
function Dash(Player: Model)
local HRP = Player:FindFirstChild("HumanoidRootPart")
local T = os.clock()
while (os.clock() - T) < 0.4 do
local Ratio = 1-((os.clock() - T)/0.4)
print(Ratio)
HRP.AssemblyLinearVelocity = vector3.new(0, HRP.AssemblyLinearVelocity.Y, 0) + (HRP.CFrame.RightVector * Ratio)
end
end
The reason i don’t set the velocity once is precisely because of the midair dash issue. By constantly setting the velocity, the different in friction between the ground and air becomes meaningless.
I added a collision group changer that sets the players collision temporarily to noclip(Collides with nothing except for other noclip parts) into their head, torso, and root part and then switches it back to players once the velocity gets destroyed. This doesn’t come with any weird behavior so if they do end up inside of a wall, it will gently kick them out of the wall all the while still making sure that the player is actually going forward and that the dash is still a valuable feature to everyone who uses it.
Lastly I changed the first value in the for loop from 101 to 60 to make sure the dash is shorter because the map is small and that super long dash is too long for the specific map you created.