local DASHUSED={}
local DASHDB={}
local DASHCD=0.5
local DashReplacementCD=3
game.ReplicatedStorage.Remotes.Dash.OnServerEvent:Connect(function(player, message, number)
if DASHDB[player] then return end
if DASHUSED[player]==nil then
DASHUSED[player]={}
end
DASHDB[player]=true
if DASHUSED[player][number]~=nil then return end
if DASHUSED[player][number]==nil and #DASHUSED[player]<2 then
table.insert(DASHUSED[player], number, message)
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 * 100)
elseif message=="BackDash" then
DashPosition=(HRP.CFrame.LookVector * -100)
elseif message=="LeftDash" then
DashPosition=(HRP.CFrame.RightVector * -100)
elseif message=="RightDash" then
DashPosition=(HRP.CFrame.RightVector * 100)
end
BV.Velocity=DashPosition
game.Debris:AddItem(BV,0.2)
end
end
task.spawn(function()
task.wait(DASHCD)
DASHDB[player]=false
end)
task.spawn(function()
task.wait(DashReplacementCD)
table.remove(DASHUSED[player],number)
end)
end)```
#how do i rework this script so its based off what the player is facing
1 messages · Page 1 of 1 (latest)
It looks like thats what the code is already doing, what are you experiencing and how exactly does it differ from what you want?