This was in a previous question, however I got the regen section to work.
Now new questions rose up. I have the script located inside a model, it is a regular script, and the model contains a part named 'fallingPart'. My first question is why does it keep falling when it regens? I had the line brick.Anchored = truemoved in several different places and it still does not want to anchor when it regens.
Please state my error, what I did wrong, and how to fix it, thank you. I am still a beginner and I'm trying to do this in 1 script (I usually do it in 2 scripts if it requires 2 functions)
local brick = script.Parent.fallingPart
local model = script.Parent
--the fall--
brick.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
brick.Anchored = false
end
end)
--the regen--
brick.Changed:connect(function(part)
if model ~= workspace then
local backup = model:Clone()
while true do
wait(5)
brick.Anchored = true
model:Destroy()
model = backup:Clone()
model.Parent = game.Workspace
model:makeJoints()
end
else
error("An error has occured in regen")
end
end)

1 comment
The above script should not regen the brick. I have no idea what you are trying to accomplish. Do you mind stating your goal?