I’m trying to put all these animation together and I’m not sure how to do that, I couldn’t find any helpful sources on the internet.
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local IdleAnimation = script:WaitForChild("Idle")
local IdleAnimationTrack = humanoid.Animator:LoadAnimation(IdleAnimation)
local RunAnimation = script:WaitForChild("Run")
local RunAnimationTrack = humanoid.Animator:loadAnimation(RunAnimation)
--the four lines of code above this comment are the ones I couldnt figure out how to put in.
--I'm also not sure how to activate the Idle animation when the player isnt moving.
local walkAnimation = script:WaitForChild("Walk")
local walkAnimationTrack = humanoid.Animator:loadAnimation(walkAnimation)
humanoid.Running:Connect(function(speed)
if speed > 0 then
if not walkAnimationTrack.IsPlaying then
walkAnimationTrack:Play()
end
else
if walkAnimationTrack.IsPlaying then
walkAnimationTrack:Stop()
end
end
end)
-- I pasted this here in my script so I can kinda visually try and put it all in one function or something.
if not IdleAnimationTrack.IsPlaying then
IdleAnimationTrack:Play()
end
Maybe I make a table?
I tried looking at the default Roblox Animate script but it wasn’t much help, Also I’m using a custom rig so the default Animate script is useless.