I’m attempting to make a dashing system where when the player presses their dashing key, they dash in the direction they were moving in.
Right now, I have the input system down, the problem is with the dashing itself. Everywhere I’ve looked, it seems that the dashing only goes one direction. What I mean is that I’m trying to make dashes where the end point changes as the player rotates. It’s hard to describe, but here are some clips to make it easier to understand:
Example 1 (The Strongest Battlegrounds):
Untitled video - Made with Clipchamp (22)
Example 2 (Your Bizarre Adventure):
Untitled video - Made with Clipchamp (21)
Example 3 (Blox Fruits):
Untitled video - Made with Clipchamp (23)
Every other dash system I come across has very linear dashing, where once it starts, the end point doesn’t change, regardless of the character rotating in the middle of it. I want to make a system like those three, but I don’t even know where to begin. I’ve been using BodyVelocity, but I’m willing to replace them.
(Extra Context: The dashing is triggered in a server-sided module script.)
All you have to do is repeatedly apply the velocity to the player’s HumanoidRootPart for the duration of the dash, instead of using a BodyMover or VectorForce.
I have a way to detect which direction the dash should go in and a way to update the end point, but when I try something like:
HumanoidRootPart.Velocity = VariableVelocity
Nothing happens. Not even an error message in the output. Am I doing something wrong? (VariableVelocity takes the form of the LookVector * 30 moving forward, -LookVector * 30 moving backward, -HumanoidRootPart.CFrame.RightVector * 30 moving left and HumanoidRootPart.CFrame.RightVector * 30 moving right)
you need to loop updating the velocity based on the LookVector/RightVector, setting it once does not work, you can use os.time or tick if you want to create a timed loop.
This is the loop I’m currently using:
while tick() - StartTime < 1.5 do
HumanoidRootPart.Velocity = DetectVelocity(HumanoidRootPart, HumanoidRootPart.CFrame.LookVector, DashDirection)
print(DetectVelocity(HumanoidRootPart, HumanoidRootPart.CFrame.LookVector, DashDirection))
The function is what the variable velocity was meant to stand for.
Here is an example of how to achieve your desired effect:
local DesiredTime = 1
local RenderStepped = game:GetService'RunService'.RenderStepped
local HumanoidRootPart = game:GetService'Players'.LocalPlayer.Character.PrimaryPart
local t = tick() + DesiredTime
while tick() < t do
HumanoidRootPart.Velocity = HumanoidRootPart.CFrame.RightVector * 30
Unfortunately, RenderStepped only can be run from local scripts. Would something like a basic wait() also suffice?
Sorry for late reply, but if you want a really hacky solution you could just temporarily set the walkspeed to an absurdly high number.
Also, renderstepped doesnt work on server, but
I used runservice.Heartbeat and it worked, thanks you two
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.