Anyone know how to use linear velocity, because whenever I do stuff like run and walk animations the running / walking arent synced with the walkspeed
Code:
local player = game.Players.LocalPlayer
local linearVelocity = script.Parent
local attachmentVelocity = script.Parent.Attachment
local humanoidRootPart = player.Character.HumanoidRootPart
attachmentVelocity.Parent = humanoidRootPart
linearVelocity.Parent = humanoidRootPart
linearVelocity.Attachment0 = attachmentVelocity
game:GetService("RunService").Stepped:Connect(function()
for i,v in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do
if v.Name == "run" then
if v.IsPlaying then
linearVelocity.MaxForce = 1e9
linearVelocity.VectorVelocity = humanoidRootPart.CFrame.lookVector * 16
end
elseif v.Name == "walk" then
if v.IsPlaying then
linearVelocity.MaxForce = 1e8
linearVelocity.VectorVelocity = humanoidRootPart.CFrame.lookVector * 16
end
end
end
end)```