How to make a second phase for my TD Boss

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a boss with a second phase because it’s cool.

  2. What is the issue? Include screenshots / videos if possible!
    I have almost no scripting experience and no idea what I’m doing.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes, I have already searched the Developer Hub for solutions, but couldn’t find any that fit my problem.

This is the script I made so far:

local currentHealth = script.Parent.Humanoid.Health

local function SecondPhase()
	if currentHealth < 100 then
		script.Parent.Humanoid.WalkSpeed = 0
		script.Parent.Humanoid.MaxHealth = 1000
		script.Parent.Humanoid.Health = 1000
		script.Parent.Humanoid.WalkSpeed = 16
	end
end

Any help would be appreciated!
(I just want to know how I can detect health and then make their speed to 0)

This seems fine, did you make sure to call the function? You probably need to put this in a while loop or a runservice function to constantly check if your boss is under 100 health.

I would use Humanoid.HealthChanged to detect this

local isSecondPhase = false

script.Parent.Humanoid.HealthChanged:Connect(function()
	if not isSecondPhase and script.Parent.Humanoid.Health < 100 then
		isSecondPhase = true -- Prevents triggering 2nd phase multiple times
		-- TODO your second phase changes here
	end
end)
1 Like

Thank you so much, this was the solution and it helped me a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.