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

How to make a part regen?

Im making a build to survive and i need some boxes to respawn every 10 seconds

3 answers

✓ Accepted answer

You would check to see if it's still there, and clone it.

while wait(10) do
	if game.Workspace:FindFirstChild("NAMEOFYOURBOXHERE") then
		print 'box is still there'
	else
		game.ServerStorage.Box:Clone().Parent = game.Workspace
	end
end

You would have to make a copy of the box inside the workspace. You could go more advanced and make a spawning brick, so it spawns on that location, but i'll leave that to you.

Sorry if this was not what you were looking for;

model=workspace:FindFirstChild("MODELNAMEHERE")
if model~=nil then
regen=model:Clone()

while wait(10) do
regen:remove()

wait(0)
model=regen:Clone()
model:MakeJoints()
m.Parent=workspace
end end

The most reliable way (I think) to regenerate things is to clone the original, and then clone that clone to use to replace it. That way you always have a spare on hand.

for example:


model = Workspace.MODELHERE
modelparent = model.Parent
modelc = model:Clone()

while true do
	wait(10)
	c = modelc:Clone()
	c.Parent = modelparent
	c:MakeJoints() -- may or may not be necessary.
end
	

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