Using TweenService for my Dash system instead of BodyVelocity?

Hey everyone, my problem is that if I use BodyVelocity, my animation doesnt work anymore. The question is: Should I use because of that my TweenService animation?

What do I want achieve?

I am creating a dash system right now but I dont know what is the better way: using TweenService instead of BodyVlocity for my Dashsystem?

I seriously dont know why my animation does not work

local Players = game:GetService("Players").LocalPlayer
local Humanoid = Players.Character:WaitForChild("Humanoid")

local RightDash = script:WaitForChild("RightDash")
local LeftDash 	= script:WaitForChild("LeftDash")

local Rightanim = Humanoid:LoadAnimation(RightDash)
local Leftanim = Humanoid:LoadAnimation(LeftDash)

local function Dash(studs, look)
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(10000,1,10000) 
	BodyVelocity.Velocity = studs * look
	BodyVelocity.Parent = HMRP
	wait(1)
	BodyVelocity:Destroy()
end

Abd the other things are not more then less:

Dash(...)
RightAnim:Play()
LeftAnim:Play()

So why does my animation not working and should I use TweenService because of that Problem?

Your animation is not working as it should from what Ican see is because you’re playing the animation after the BodyVelocity is destroyed, Use Debris:Additem() to destroy the Bodyvelocity after 1 second as to not yield the thread

local debris = game:GetSerivce("Debris")

local function Dash(studs, look)
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.MaxForce = Vector3.new(10000,1,10000) 
	BodyVelocity.Velocity = studs * look
	BodyVelocity.Parent = HMRP
	debris:AddItem(BodyVelocity,1)
end

Okey should I set my animation as movement or action`?

It would be recommended set the Priority to Movement

2 Likes

Okey lemme try everything and then I will still see if it doesnt work