Need help with animating a "boss battle"

Hello, a friend of mine suggested me to start making a boss battle for his sword fighting game. The parts with modeling, welding and animating were very easy. But the scripts were very hard to take care of. I did what I could do and tried documenting myself about how animations work and what you need to do to make them work. All I want is making other the animations play. The only animation that was also the final result was making the idle animation work.

Here’s a list with everything I tried:

  • Used the owner’s animation ids
  • Looped the animations (only idle and running)
  • Used Animators in humanoid
  • Changing priorities to what fits better
  • Tested in the roblox game and not in studio

I will edit this topic later about the outcome.

Here’s the script used for making the boss run

local humanoid = script.Parent:WaitForChild('Humanoid')
--local event = script.Parent.Events >> Useless for now <<
--local folder = script.Parent.Anims >> Useless for now <<
----------------------------- OBJECTS -----------------------------


----------------------------- FUNCTIONS -----------------------------
function stop_animation()
	for i, v in pairs(script.Parent.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop(0)
	end
end
----------------------------- FUNCTIONS -----------------------------


----------------------------- ANIMATION SETUPS -----------------------------

local idleanim = script:WaitForChild("VIPBossIdle")
local runanim = script:WaitForChild("VIPBossRun")
local slashanim = script:WaitForChild("VIPBossSlash")

local slash_animator = Instance.new("Animator", script.Parent.Humanoid)
local slash_load = slash_animator:LoadAnimation(slashanim)

local idle_animator = Instance.new("Animator", script.Parent.Humanoid)
local idle = idle_animator:LoadAnimation(idleanim)
idle:Play()

local run_animator = Instance.new("Animator", script.Parent.Humanoid)
local run = run_animator:LoadAnimation(runanim)

----------------------------- ANIMATION SETUPS -----------------------------

-- I use this part to test the boss if it's working.
wait(30) -- Time until I reach the boss

stop_animation()
wait(1)
run:Play()
local plrs = {}
for i, v in pairs(game.Players:GetChildren()) do
	table.insert(plrs, v)
end

local target = plrs[math.random(1, #plrs)].Character.HumanoidRootPart

script.Parent.Humanoid:MoveTo(target.Position)

Remember that only the Idle is playing. And the running animation doesn’t work when I make the boss walk.

did you change the priorities?

sorry for late response. They were on the action priority before.

the script looks normal, is the id typed in? or have you played the animation first to test if the animation even works?

1 Like

okay, soooo i took the script, put it in a dummy, and poorly made the animations, and it works?

the idle anim is idle priority, running is movement, and slash is action

i even have a video for it:

probably the problem is coming from the animations you made

2 Likes

The ids of the animations are typed in