I wrote a script so a part can fall once a player touches it and regenerate after a short time. The script is a regular script and is located inside a part. It falls just fine, but when it comes to the regen function it does nothing an "The Parent property of Workspace is locked" is displayed in the output.
THE SCRIPT
-------------------------------------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 end end) ----------------------------------regen----------------------------------------- brick.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)
The brick cannot be the workspace, but it can be a child of it.
Change line 13 to
if brick.Parent ~= workspace then