CCCPaste

BossFight System (STORY GAME)

local BossTeacher = game.Workspace.EvilTeacher

local function playMonsterAnimation()
	local animation = Instance.new("Animation",BossTeacher)
	animation.AnimationId = "https://roblox.com/assets/?id=1083195517"

	local humanoid = BossTeacher:FindFirstChild("Humanoid")
	humanoid:LoadAnimation(animation):Play()

	wait(1)

	animation:Destroy()
end

local function fireballChallenge()

	for i=1,3 do

		playMonsterAnimation()

		for i,player in pairs(game.Players:GetPlayers()) do
			if player.Character then
				local fireball = game.ReplicatedStorage.Fireball:Clone()
				local target = game.ReplicatedStorage.Target:Clone()


				target.Parent = game.Workspace
				target.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0,3,0)) * CFrame.Angles(0,0,math.rad(90))

				wait(0.5)

				fireball.Parent = game.Workspace
				fireball.CFrame = target.CFrame + Vector3.new(0,60,0)

				wait(2)

				target:Destroy()
			end
		end

		wait(1)
	end
end

local function LavaChallenge()
	
	local LavaPart = game.ReplicatedStorage.LavaPart:Clone()
	LavaPart.Parent = workspace
	
	wait(10)
	
	LavaPart:Destroy()
end

spawn(function()
	while true do
		wait(0.5)
		fireballChallenge()
		wait(0.5)
		fireballChallenge()
		wait(0.5)
		fireballChallenge()
		wait(0.5)
		LavaChallenge()
		wait(0.5)
		if BossTeacher.Humanoid.Health <= 0 then
			break
		end
	end
end)

repeat wait(0.1) until BossTeacher.Humanoid.Health <= 0