#Need help playing animations
24 messages · Page 1 of 1 (latest)
I think so
I’m following a tutorial and the person doing the tutorial didn’t have any problems with it
You want to play it on keybind?
No automatically
The whole time?
Until it reaches the end and respawns
Oh so like an emote
It’s for an enemy In a tower defense game
so walking anim?
Yeah
wait I think i made something like that let me send you the script
Thx
local bot = script.Parent
local humanoid = bot:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local walkingAnim = Instance.new("Animation")
walkingAnim.AnimationId = "rbxassetid://YOUR_ANIMATION_ID"
local walkAnimationTrack = nil
local function playWalkAnimation()
if not walkAnimationTrack then
walkAnimationTrack = animator:LoadAnimation(walkingAnim)
end
if not walkAnimationTrack.IsPlaying then
walkAnimationTrack:Play()
end
end
local function stopWalkAnimation()
if walkAnimationTrack and walkAnimationTrack.IsPlaying then
walkAnimationTrack:Stop()
end
end
humanoid.MoveDirectionChanged:Connect(function(moveDir)
if moveDir.Magnitude > 0 then
playWalkAnimation()
else
stopWalkAnimation()
end
end)
humanoid.Died:Connect(function()
if walkAnimationTrack then
walkAnimationTrack:Stop()
end
end)
I think you need to make a few adjustments
Thx
** You are now Level 1! **
What do you mean?
The mob is the parent