You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the player to be able to dash in the direction of it’s humanoid’s MoveDirection. -
What is the issue? Include screenshots / videos if possible!
From what I’ve seen, the player is flung to the farlands (a point where the player is so far away their avatar starts glitching) and dies, when they manage to perfectly time jumping and dashing at the same time. this issue is more likely to occur when there are a lot of enemy npc’s and the game starts lagging. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried countering this issue by shortening the window the player has to time it perfectly by deleting the BodyVelocity faster and increasing it’s power to accommodate for how fast it gets deleted, but this only makes the problem less likely to happen, not entirely erase it.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is my dash script:
local rem = game.ReplicatedStorage.Dash
local staminaPenalty = 50
rem.OnServerEvent:Connect(function(plr, Hum)
local stam = Hum:FindFirstChild("Stamina")
local Force = 360000000
local Speed = 36000000
if Hum.FloorMaterial == Enum.Material.Air then
Force = Force/2 -- this makes the player slower if they are on air, since the power of the dash will be amplified when they are in air
Speed = Speed/2
end
Hum.WalkSpeed += 30
stam.Value -= staminaPenalty
local TotalForce = Force
local KnockBack = Instance.new("BodyVelocity")
KnockBack.Parent = plr.Character:FindFirstChild("HumanoidRootPart")
KnockBack.MaxForce = Vector3.new(TotalForce,0,TotalForce)
KnockBack.Velocity = Hum.MoveDirection * Speed
task.wait(0.0001)
KnockBack:Destroy()
task.wait(.3)
Hum.WalkSpeed = Hum.WalkSpeed - 30
end)