local DASHUSED={}
local DASHDB={}
local TimeTillReset=1.5
local DASHCD=0.5
local DASHCFRAMES={
[1]=CFrame.new(-1,-1,-20),
[2]=CFrame.new(-1,-1,20),
[3]=CFrame.new(-20,-1,-1),
[4]=CFrame.new(20,-1,-1),
}
game.ReplicatedStorage.Remotes.Dash.OnServerEvent:Connect(function(player, message, number)
if DASHDB[player] then return end
DASHDB[player]=true
if DASHUSED[player]==nil then
DASHUSED[player]={}
end
if not DASHUSED[player][number] and #DASHUSED[player]<2 then
table.insert(DASHUSED[player], number, message)
elseif #DASHUSED[player]==2 then
task.wait(TimeTillReset)
table.clear(DASHUSED[player])
end
local HRP=player.Character:WaitForChild("HumanoidRootPart")
if HRP then
local LV=Instance.new("LinearVelocity",HRP)
local Attachment=Instance.new("Attachment", HRP)
local CFrameCalculated
if message=="FrontDash" then
CFrameCalculated=HRP.CFrame * DASHCFRAMES[1]
elseif message=="BackDash" then
CFrameCalculated=HRP.CFrame * DASHCFRAMES[2]
elseif message=="LeftDash" then
CFrameCalculated=HRP.CFrame * DASHCFRAMES[3]
elseif message=="RightDash" then
CFrameCalculated=HRP.CFrame * DASHCFRAMES[4]
end
LV.MaxForce=math.huge
LV.VectorVelocity=(Vector3.new(CFrameCalculated) - HRP.Position).Unit * Vector3.new(100,0,100)
LV.Attachment0=Attachment
game.Debris:AddItem(LV,0.1)
game.Debris:AddItem(Attachment,0.1)
task.wait(DASHCD)
DASHDB[player]=false
end
end)```
#how to properly make a dash system (as in strongest battlegrounds, etc.)
1 messages · Page 1 of 1 (latest)
everything works but when i do the actual dash, it just sends me back and forth and everywhere
(don't mind my avatar i just thought of making it look stupid)
i can see that lookvectors for a sec but then it disappears
Try Using LookVector instead of CFrames. Those predetermined CFrame is based off the world origin and will always pull you toward it.
Mb I wasnt verified
i just did this
HRP.Position=DashPosition
still getting tp'd to random positions
whats the full code again
local DASHUSED={}
local DASHDB={}
local TimeTillReset=1.5
local DASHCD=0.5
game.ReplicatedStorage.Remotes.Dash.OnServerEvent:Connect(function(player, message, number)
if DASHDB[player] then return end
DASHDB[player]=true
if DASHUSED[player]==nil then
DASHUSED[player]={}
end
if not DASHUSED[player][number] and #DASHUSED[player]<2 then
table.insert(DASHUSED[player], number, message)
elseif #DASHUSED[player]==2 then
task.wait(TimeTillReset)
table.clear(DASHUSED[player])
end
local HRP=player.Character:WaitForChild("HumanoidRootPart")
if HRP then
local DashPosition
local LV=Instance.new("LinearVelocity", HRP)
LV.MaxForce=math.huge
local Attachment=Instance.new("Attachment",HRP)
if message=="FrontDash" then
DashPosition=(HRP.CFrame.LookVector * 25)
elseif message=="BackDash" then
DashPosition=(HRP.CFrame.LookVector * -25)
elseif message=="LeftDash" then
DashPosition=(HRP.CFrame.RightVector * -25)
elseif message=="RightDash" then
DashPosition=(HRP.CFrame.LookVector * 25)
end
LV.VectorVelocity=DashPosition
LV.Attachment0=Attachment
game.Debris:AddItem(LV,0.1)
task.wait(DASHCD)
DASHDB[player]=false
end
end)```
i changed the code a little bit but gives same results
Alright so
At first, your problem was that you just teleported them to the dash position, without having used a body velocity or something to propel the player forward
Now I'd just suggest
lowering the maxforce a bit
so it doesn't teleport you, you know?
i don't rlly tp no more it just goes in random directions
Alright so
my suggestions are
lowering the max force
to 50,50,50
or 100,100,100
since it moves in multiple directions
that way it can move smoothly but surely
I see
I'm pretty sure your math is a bit wrong
anyway, you should probably switch to using a "BodyVelocity" instead
I would say it's easier to work with
especially for systems such as this
didnt realize this but it used lookvector for right dash
fixed it
local DASHUSED={}
local DASHDB={}
local DASHCD=3
game.ReplicatedStorage.Remotes.Dash.OnServerEvent:Connect(function(player, message, number)
if DASHDB[player] then return end
DASHDB[player]=true
if DASHUSED[player]==nil then
DASHUSED[player]={}
end
if not DASHUSED[player][number] and #DASHUSED[player]<2 then
table.insert(DASHUSED[player], number, message)
elseif #DASHUSED[player]==2 then
task.wait(DASHCD)
table.clear(DASHUSED[player])
end
local HRP=player.Character:WaitForChild("HumanoidRootPart")
if HRP then
local DashPosition
local BV=Instance.new("BodyVelocity", HRP)
BV.MaxForce=Vector3.new(100,0,100)
if message=="FrontDash" then
DashPosition=(HRP.CFrame.LookVector * 25)
elseif message=="BackDash" then
DashPosition=(HRP.CFrame.LookVector * -25)
elseif message=="LeftDash" then
DashPosition=(HRP.CFrame.RightVector * -25)
elseif message=="RightDash" then
DashPosition=(HRP.CFrame.RightVector * 25)
end
BV.Velocity=DashPosition
game.Debris:AddItem(BV,0.5)
task.wait(DASHCD)
DASHDB[player]=false
end
end)
now it just doesn't move me
alr
only moved me when i changed maxforce to math.huge
💔
also its fixed now just gotta uh
change debris time
So the deal with BodyVelocity is that it can only be applied to parts that have no NetworkOwner or it is applied by the NetworkOwner themselves
wiat what how
local DASHUSED={}
local DASHDB={}
local DASHCD=3
game.ReplicatedStorage.Remotes.Dash.OnServerEvent:Connect(function(player, message, number)
if DASHDB[player] then return end
DASHDB[player]=true
if DASHUSED[player]==nil then
DASHUSED[player]={}
end
if not DASHUSED[player][number] and #DASHUSED[player]<2 then
table.insert(DASHUSED[player], number, message)
elseif #DASHUSED[player]==2 then
task.wait(DASHCD)
table.clear(DASHUSED[player])
end
local HRP=player.Character:WaitForChild("HumanoidRootPart")
if HRP then
local DashPosition
local BV=Instance.new("BodyVelocity", HRP)
BV.MaxForce=Vector3.new(math.huge,0,math.huge)
if message=="FrontDash" then
DashPosition=(HRP.CFrame.LookVector * 50)
elseif message=="BackDash" then
DashPosition=(HRP.CFrame.LookVector * -50)
elseif message=="LeftDash" then
DashPosition=(HRP.CFrame.RightVector * -50)
elseif message=="RightDash" then
DashPosition=(HRP.CFrame.RightVector * 50)
end
BV.Velocity=DashPosition
game.Debris:AddItem(BV,0.4)
task.wait(DASHCD)
DASHDB[player]=false
end
end)```
ah nvm i was talking nonsene if it is a instance then it should work on the server as well
mb
i have another favor, how do i make the separate dash come back
like lets say
i used front dash
2 seconds ago
and i just used side dash
how do i make them come back separately in like 3 seconds
ok wait im sparkin an idea in my head
** You are now Level 13! **
what exactly do you mean by "come back"
alr
nvm i think im on the right track but just cant thnk of it
it just comes back
means you can use it again
cd happens
you can use it again
in tsb, you can usually do a side dash right after a front dash
just making it clearer
Ah like tsb....
this kinda gives me a flash back of certain fella anyways
Just separte the dash systems
so one dash system for side dashes only and one for front and back dashes
ok i think this one does it but its both dashes 💔
and im pretty sure it just resets the task.wait
so what exactly have you done here now so i can understand
i just did this and pray it works
im going toremove storeddashes i think its useless now
so what exactly did this do now?
aren't you trying to change he DASHCD or what am i missing
it feels like im misunderstanding something
ok so i got another problem woohoo i hate problems
local PLRS=game:GetService("Players")
local RS=game:GetService("ReplicatedStorage")
local UIS=game:GetService("UserInputService")
local Remotes=RS:WaitForChild("Remotes")
local Dash=Remotes:WaitForChild("Dash")
local player=PLRS.LocalPlayer
local char=player.Character
local hum=char:WaitForChild("Humanoid")
UIS.InputBegan:Connect(function(input, GPE)
if UIS:IsKeyDown(Enum.KeyCode.W) or hum.MoveDirection.Magnitude==0 and UIS:IsKeyDown(Enum.KeyCode.Q) then
Dash:FireServer("FrontDash", 1)
elseif UIS:IsKeyDown(Enum.KeyCode.S) and UIS:IsKeyDown(Enum.KeyCode.Q) then
Dash:FireServer("BackDash", 1)
elseif UIS:IsKeyDown(Enum.KeyCode.A) and UIS:IsKeyDown(Enum.KeyCode.Q) then
Dash:FireServer("LeftDash", 2)
elseif UIS:IsKeyDown(Enum.KeyCode.D) and UIS:IsKeyDown(Enum.KeyCode.Q) then
Dash:FireServer("RightDash", 2)
end
end)
i press W or A or S or D and it just dashes
didnt even press Q
you need to do if UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.Q) or hum.MoveDirection.Magnitude==0 and UIS:IsKeyDown(Enum.KeyCode.Q) then
ok nvm i LIED its just the W key
💔
ohhh
mb LOL
all gud
i saw a youtuber do that and it worked for them so idk unless i was tweaking
well did it fix it?
yeah but still have a problem with dash cd
lets say i did forward dash a second ago and now i just did left dash
in seconds it would be like
FD:1
LD:0
FD:2
LD:1
so on
and then when the dashes reach 3
it resets
to make it useable
i see
but isn't the easiest way just to separate the dashes into to different scripts
so they don't share a cooldown or you don't have to make more if statements
ill just do the different scripts then
i mean we can try to make it work in one script you decide
ok yk what ill just try to do it in one script since most things require one script