Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a part regen?

Asked by
Rukory 0
10 years ago

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

3 answers

Log in to vote
1
Answered by 10 years ago

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.

Ad
Log in to vote
0
Answered by 10 years ago

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
Log in to vote
-2
Answered by
jav2612 180
10 years ago

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

Answer this question