Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Deleting this brick without locking its parent?

An expansion of my previous question, which was starting to have people give me scripts because I didn't post my own script.

I have a script here that clones a drop and positions it like it is falling of a pipe. When the droplet hits the floor (a brick named puddle), it is supposed to disappear. However, I am using the destroy method to make it disappear, and that is causing the droplet's parent (Workspace) to become "locked". Every time the script tries to loop and spawn the second droplet, it can't and gives the output "The Parent property of Droplet is locked"

How do I make it so that when the droplet is destroyed, the parent isn't locked?

Little = Workspace.Drop:Clone()
while true do
	Little.Parent = Workspace
	Little.Position = Vector3.new(81.3, 7.3, 99.1)
	Little.Name = "Droplet"
	Little.Touched:connect(function(part)
		if part.Name == "Puddle" then
			Little:Destroy()
		end
	end)
wait(5)
end

2 comments

0

You can't. :Destroy() removes it from the game, so you can't get it back.

0

No. All that is being destroyed is the drop's Clone. The clone has nothing in it or attached to it and is a child of Workspace. I don't want back because I am just going to create another in 5 seconds.

2 answers

I would use Little:remove() or Little = nil because Little:Destroy() removes is completely from the game, so it won't be possible to clone it.

Litte = game.Lighting.Drop --Drop MUST be in workspace
while true do
Little:Clone()
Little.Parent = Workspace
Little:remove()
wait() -- makes sure that studio doesn't crash
end

-- HOPE THIS HELPED :)

4 comments

0

1: Little isn't being cloned. Drop is. 2: Little = nil doesn't work because then it just becomes a nil value and sits there, but doesn't disappear. 3, Litle:Remove() works the first time, but then every other time the part spawns it doesn't disappear.

0

Just edited the code, this should work :)

0

Your new script doesn't make any sense. You are making a clone but not giving it a parent location to spawn in. All you are doing is telling the Drop to parent itself to the workspace.... which it already is. Then you are removing the drop instantaneously after that.

0

Wait, I forgot, Little was meant to be in Lighting... Sorry

Try doing Little.Visibility = 1 That way it only appears that the droplet is gone, but really you still have it ready to be used again. Or, you could clone it before you remove it, with Little:Clone().Parent = What you want it's parent to be

This discussion is preserved as it was. New answers, comments, and votes are closed.