Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Regenerating a model every 5 minutes

Ok so I have a game where you destroy things like the eiffel tower and stuff but I was wondering how to make it so that the things get fixed like every 5 minutes?

1 comment

0

You should rename the title of this question to something more helpful like "Regenerating every 5 minutes" as "Destroying" isn't very helpful.

2 answers

You could make a regeneration script:

local obj = Workspace['Tower']; --change tower to the name of your model
local clone = obj:Clone()

while true do
	wait(5*60) -- wait 5 minutes
	if Workspace:findFirstChild("Tower") then --change Tower to the name of your model
		Workspace['Tower']:Destroy()
	end

	local cclone = clone:Clone()
	
	cclone.Parent = Workspace
	cclone:MakeJoints()
end

3 comments

0

Thx

0

Also, title your questions better. Destroying doesn't give us a good idea of what you want before we read the question's expansion.

0

Wait, forgot to destroy the old model, let me fix that.

Put the model that gets destroyed in Lighting.

Copy and paste this into a Script, in Workspace:

local model = game.Lighting["MODEL NAME"]

function Reload()
	local newm = model:Clone()
	newm.Parent = game.Workspace
	newm.Name = "Destroy"
end

Reload()

while wait(300) do --Wait 5 minutes
	if game.Workspace["Destroy"] then
		game.Workspace["Destroy"]:Destroy()
	end
	Reload()
end

Don't know if will work, watching Red Dawn, so my focus isn't 100% there, haha. If it doesn't, then just comment and tell me, and I will re-edit.

2 comments

1

You should put the wait at the end of the loop or call Reload() before the loop. Otherwise the tower won't exist for 5 minutes after you join.

0

Oh yes, thank you so much.

This discussion is preserved as it was. New answers, comments, and votes are closed.