#dash

1 messages · Page 1 of 1 (latest)

smoky glacier
#

how am i able to make this working dash system to only be able to dash left and right, i have 2d movement but if i try dashing then pressing d right after it starts going front n shi `local uis = game.UserInputService
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

local key = Enum.KeyCode.C

local boostAnim = Instance.new("Animation")
boostAnim.AnimationId = "rbxassetid://110269833815516"
local animator = hum:WaitForChild("Animator")

local currentAnimTrack = nil

local dashSound = Instance.new("Sound")
dashSound.SoundId = "rbxassetid://5989939664"
dashSound.Parent = char:WaitForChild("HumanoidRootPart")

local function playAnimation()
if not currentAnimTrack or not currentAnimTrack.IsPlaying then
currentAnimTrack = animator:LoadAnimation(boostAnim)
currentAnimTrack:Play()
end
end

local function stopAnimation()
if currentAnimTrack and currentAnimTrack.IsPlaying then
currentAnimTrack:Stop()
end
end

local function playDashSound()
dashSound:Play()
end

uis.InputBegan:Connect(function(inp, gpe)
if inp.KeyCode == key and not gpe then
hum.WalkSpeed = 20

    local bv = Instance.new("BodyVelocity", char:FindFirstChild("HumanoidRootPart"))
    bv.P = 1000
    bv.MaxForce = Vector3.new(99999, 99999, 99999)
    bv.Velocity = char:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 100

    game.Debris:AddItem(bv, 0.1)

    playAnimation()
    playDashSound()
end

end)

uis.InputEnded:Connect(function(inp, gpe)
if inp.KeyCode == key and not gpe then
hum.WalkSpeed = 16
wait(0.5)
stopAnimation()
end
end)
`

pallid cairn
#

local function playDashSound()
dashSound:Play()
end

why make function for this

worldly zephyr
#

can you make a video for this since i am on more visual side 🙂 so i can provide you a detail explanation.

worldly zephyr
#

it must be the fault of look vector..

#

ok instead of having to use look vector use vector3

wooden galleon
# smoky glacier

Yeah so when you rotate your character and begin to dash the character doesnt fully ritate

smoky glacier
#

so

#

am i supposed to change something in the script

worldly zephyr
#

yes

smoky glacier
#

uhhuh

#

i make the look vector3?

#

thats it

#

?

worldly zephyr
#

yeah

#

use vector3 for velocity

#

you must use movedirection for this

smoky glacier
#

oh my god

gilded stratusBOT
#

studio** You are now Level 9! **studio

smoky glacier
#

it worked

#

thank you

worldly zephyr
#

alr