How come this brick isn't regening properly?
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
03 | local brick = script.Parent |
05 | brick.Touched:connect( function (part) |
06 | if part.Parent:FindFirstChild( "Humanoid" ) and not fallen then |
08 | brick.Anchored = false |
12 | brick.Changed:connect( function (part) |
13 | if brick ~ = workspace then |
14 | local backup = brick:Clone() |
18 | brick = backup:Clone() |
19 | brick = game.Workspace |
23 | error ( "Nothing happened!" ) |