Hello. I need some Scripting help.... :/

I have began making a Tycoon and so far it is working pretty well. I've run into quite a few issues and fixed them all. But right now I can't seem to fix this one.

So ever 15 minutes I want a boss to spawn in. And I have tried doing so with simply cloning the boss model. Then teleporting it to some specific coordinates. That all works fine but I want it to do this everytime the boss is killed. Is anyone able to help me get this script to repeat after the boss is killed?

local Baldi = game.Workspace.Baldi
local clonedObject = Baldi:Clone(1)

while true do
for i = 3, 0, -1 do
	wait(1)
	script.Parent.Text = "Boss Will Spawn In: "..i
	if script.Parent.Text == "Boss Will Spawn In: 0" then
		script.Parent.Visible = false

		wait(2)
	clonedObject.Parent = game.Workspace
	clonedObject.Name = "Baldi2"
end
end
end

if clonedObject.Humanoid.Health == 100 then
clonedObject:MoveTo(Vector3.new(-104.495, 30.132, -120.44))
end
if clonedObject.Humanoid.Health == 0 then
	wait(1)
	clonedObject:Destroy()
	if clonedObject:Destory() then
	script.Parent.Visible = true
	end
end
wait()

7 comments

0

just do while wait(900) do instead of while true do

0

The issue with that is I also have a timer gui that I want to display how long until the boss spawns in thats what the whole for i = 3, 0, -1 do thing is for.

0

then instead using an if statment for the text use wait(900)

0

but I want the time bar at the top.

0

You can use the Died event from the Humanoid class. Here's a link that shows an example of it: http://robloxdev.com/api-reference/event/Humanoid/Died

0

By the way, the Clone function does not take any arguments

0

Yeah I know I was just trying different things to stop the clone from rapidly cloning so and I forgot to delete that