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

How come this brick isn't regening properly?

Asked by 8 years ago

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

01-------------------------------------short cuts----------------------------------
02local fallen = false
03local brick = script.Parent
04-------------------------------------the fall-------------------------------------
05brick.Touched:connect(function(part)
06    if part.Parent:FindFirstChild("Humanoid") and not fallen then
07        fallen = true
08        brick.Anchored = false
09    end
10end)
11----------------------------------regen-----------------------------------------
12brick.Changed:connect(function(part)
13    if brick ~= workspace then
14        local backup = brick:Clone()
15        while true do
View all 25 lines...
1
on line 19 you set brick to game.workspace User#5423 17 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

The brick cannot be the workspace, but it can be a child of it.

Change line 13 to

1if brick.Parent ~= workspace then
Ad

Answer this question