I’m trying to make a dash ability in my 2d platformer were eating different kinds of fruits gives you abilities
I’m trying to make a cherry that enables the player to dash but im not sure how to do this
does anyone know how I could make a dash similar to blox fruits were the player does not fall when dashing and goes in a straight line forward so they would be able to cross big gaps without falling
also having the white trails behind the players arms would be nice but the main thing to figure out is how to make the actual dash
I had a freind try and make it but the problem was it just made the player walk fast in one direction so the player would still fall down im not sure if anyone would be able to fix the code it would probally be better to just fully make something new but heres the code anyways
-- local m = false
local AKeyDown = false
local DKeyDown = false
local DashDeb = false
local DashTime = 0.3
local anim = "it wont work when its has nothing so contact me when u put sm inside so i script it"
function begin(x)
x:Destroy()
m = true
end
local TweenService = game:GetService("TweenService")
local Char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local HRP = Char:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
for _, v in ipairs(workspace:GetDescendants()) do
if v:IsA("Folder") and v.Name == "Cherries" then
for _,x in ipairs(v:GetChildren()) do
x.EPrompt.TextLabel.MouseButton1Click:Connect(function()
begin(x)
end)
game.UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and (x.Position - game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").Position).Magnitude <= 40 then
begin(x)
end
end)
end
end
end
UIS.InputBegan:Connect(function(Key,IsTyping)
if IsTyping then return end
if Key.KeyCode == Enum.KeyCode.Space and m == true then
if DashDeb == false and Char:FindFirstChild("Deb") == nil then
DashDeb = true
delay(DashTime + 0.7,function()
DashDeb = false
end)
elseif AKeyDown then
local Tween = TweenService:Create(HRP,TweenInfo.new(DashTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Velocity = HRP.CFrame.LookVector * 70})
Tween:Play()
delay(DashTime + 0.1,function()
end)
elseif DKeyDown then
local Tween = TweenService:Create(HRP,TweenInfo.new(DashTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Velocity = -HRP.CFrame.LookVector * -70})
Tween:Play()
end
end
end)
local UIS = game:GetService("UserInputService")
game["Run Service"].RenderStepped:Connect(function()
if UIS:IsKeyDown(Enum.KeyCode.A) then
AKeyDown = true
else
AKeyDown = false
end
if UIS:IsKeyDown(Enum.KeyCode.D) then
DKeyDown = true
else
DKeyDown = false
end
end)
code already has the feature for eating the cherry all I need is the actual dashing system so you can ignore the other stuff