I made a script where a brick falls when touched and regenerates after 3 seconds
-------------------------------------short cuts----------------------------------
local fallen = false
local brick = script.Parent
-------------------------------------the fall-------------------------------------
brick.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") and not fallen then
fallen = true
brick.Anchored = false
wait (3)
brick.Anchored = true
fallen = false
end
end)
----------------------------------regen-----------------------------------------
script.Parent.Changed:connect(function(part)
if brick ~= workspace then
local backup = brick:Clone()
while true do
wait (3)
brick:Destroy()
brick = backup:Clone()
brick = game.Workspace
brick:makeJoints()
end
else
error("Nothing happened!")
end
end)
It falls fine, but it keeps saying "The Parent property of Workspace is locked" in the output and it doesn't regen. Could it be it being anchored again after falling?
Script is inside the brick

2 comments
Can you please explain what was changed and what I did wrong?
Plus this doesn't work