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

Regenerating a model every 5 minutes

Asked by 10 years ago

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?

0
You should rename the title of this question to something more helpful like "Regenerating every 5 minutes" as "Destroying" isn't very helpful. User#2 0 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago

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
0
Thx omarz123 5 — 10y
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. Thewsomeguy 448 — 10y
0
Wait, forgot to destroy the old model, let me fix that. Thewsomeguy 448 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

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.

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. nate890 495 — 10y
0
Oh yes, thank you so much. AmericanStripes 610 — 10y

Answer this question