I’m making a directional dash system for my game, using .Velocity since that seemed like the best option for what I’m trying
For some reason whenever I use .Velocity on the RootPart’s LookVector and multiply it for 45 to go forward, but * 45 barely moves the root part forward, and going ANY number above 45 for some reason makes it dash incredibly far. Examples:
Using 45: https://gyazo.com/0eb5ed4032f167f4aaa2511657342dbe.mp4
I’ve tried to not add the velocity onto the rootpart’s already existing velocity, but that didn’t work, and I couldn’t find any solutions in here either.
This is the code I’m using!
if input.KeyCode == Enum.KeyCode.C then
local direction = root_part.CFrame:vectorToObjectSpace(hum.MoveDirection).Unit
if hum.MoveDirection.Magnitude > 0 and chr:GetAttribute("DashCooldown") == 0 then
local success
if (hum.MoveDirection:Dot(root_part.CFrame.LookVector) > 0.75) then
success = true
root_part.Velocity = root_part.Velocity + root_part.CFrame.LookVector * 45
end
if (hum.MoveDirection:Dot(root_part.CFrame.LookVector) * -1 > 0.75) then
success = true
root_part.Velocity = root_part.Velocity + root_part.CFrame.LookVector * -45
end
if (hum.MoveDirection:Dot(root_part.CFrame.RightVector) > 0.75) then
success = true
root_part.Velocity = root_part.Velocity + root_part.CFrame.RightVector * 45
end
if (hum.MoveDirection:Dot(root_part.CFrame.RightVector) * -1 > 0.75) then
success = true
root_part.Velocity = root_part.Velocity + root_part.CFrame.RightVector * -45
end
if success then
action_event:FireServer("CooldownCreation",{Name = "DashCooldown", Cooldown = 2.5})
end
end
end
It’s the same thing as wait vs task.wait, both do the sane thing but one is better and has more support + is more recent. Imo u can use but I’d not use it cause it’ll cause you to be motivated to use deprecated objects in the future
Apologies for not replying, I was busy! But this works great, thank you so much! It seems to still have the problem of for some reason being sensitive after a certain number, but this is much more manageable
Wait… I… forgot that I had to do directional dashes, this works for forward dashes, but not for anything directional, I tried doing root_part.AssemblyLinearVelocity = (hum.MoveDirection * root_part.CFrame.LookVector)*80
this, to try to fix it, but I got this as a result, it only happens if you’re looking in the direction I’m looking at, though
That’s because you’re multiplying MoveDirection by the root part’s LookVector, which is not necessarry since you’re already dashing towards the direction the player is walking to using MoveDirection.
Also, I think the velocity might be sensitive because of the friction with the ground. You can try using VectorForce for that and attach it to the root part’s RootAttachment.
I’ve tried using VectorForce and couldn’t get it to work, but this works verywell,t hanks for making me realize I was being a little dumb, haha, anyway, now it’s definitely fixed