--Hello, I'm a new scripter just getting into the fun of it and I've made this script that checks for int values and upon certain values changes the color of a brick and eventually breaks apart the blocks(it's supposed to do that) and everything in this script works just like I want it to.. except for my regen function (the first function) when I click my regen button on my GUI for the first time it works... however when I try to regen it a second time I get an error saying that
("The Parent property of SDoor is locked")
I'm not sure what this means and upon searching google I came up with nothing ? A little bit of help to enlighten me on what I'm doing wrong would be very much appreciated! I've included a screen shot of the error below
IMAGE LINK: http://imageshack.com/a/img834/284/ruvl.png
copy=game.Workspace.SDoor.SDoor:Clone()
function regen()
modd=game.Workspace.SDoor
modd2=game.Workspace.SDoor.SDoor
wait(.2)
zt=modd2:clone()
wait(.2)
modd2:Destroy()
wait(.5)
copy.Parent=nil
copy.Parent=modd
wait(.2)
modd.safelight.hold.Value=0
wait(.2)
check()
end
function check()
while true do
wait(.5)
door=script.Parent.Parent.SDoor:GetChildren()
modd2=game.Workspace.SDoor.SDoor
h=script.Parent.hold.Value
modd=game.Workspace.SDoor.SDoor:GetChildren()
screen=script.Parent.light
value=modd2.Value
rk=modd2:clone()
if value.Value==1 then
regen() break
end
if h <5 then
screen.BrickColor=BrickColor.new("Lime green")
for j = 1,#modd do
if modd[j].Name=="Part" then
modd[j].CanCollide=true
end
end
end
if h >=700 then
screen.BrickColor=BrickColor.new("Bright yellow")
end
if h >= 1200 then
for i = 1,#modd do
if modd[i].Name=="Part" then
modd[i].Anchored=false
screen.BrickColor=BrickColor.new("Really red")
end
end
end
end
end
check()

1 comment
I believe I see your problem.. What is the name of the IntValue inside the 2nd Sdoor...