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

How do you keep a model from falling apart when you re spawn it?

Asked by 6 years ago

Making a game where you have to blow stuff up and the parts are not anchored. So how do you make it so the model doesn't fall apart upon re spawn?

Cheers

local regenTime = 180 -- 3 minutes
local messageTime = 2

local model = script.Parent
local message = Instance.new("Message")

--Check that the script hasn't been placed in workspace
if model ~= workspace then 
    message.Text = "Regenerating Massive Noob This May Cause Lag"

    local backup = model:clone() -- Make the backup 

    while true do 
        wait(regenTime) 

        --Remove the model
        model:Destroy()

        --Show the message
        message.Parent = game.Workspace 
        wait(messageTime)
        message.Parent = nil

        --Copy the backup
        model = backup:clone() 
        model.Parent = game.Workspace 
        model:makeJoints()
    end
else
    error("Script not put in a model! Nothing to regenerate!")
end
0
I would expect MakeJoints() to work. If the model is fine before the regeneration, consider moving it (ex up 1 stud) so that it isn't in contact with anything else when the script performs "model:Clone()"? chess123mate 5873 — 6y
0
that doesn't work! :(f KiwiAviation 0 — 6y

Answer this question