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

holo error, clear not working. Am I doing something completely wrong?

So I was trying to make a holo, and the loading works. I can say "load meadows" and it would load meadows. But clearing does not work. I want to set the children of holo's parent to Lighting when I say "clear" so I put this code

player.Chatted:connect(function(msg)
			if msg == "clear" then
				for index, child in pairs(workspace.holo:GetChildren()) do
    			index, child.Parent = game.Lighting
				end
end

But instead of changing the parent to Lighting, it removes it altogether so that I can't load it again. Am I doing something completely wrong?

2 comments

1

child.Parent = game.Lighting -- Just this on line 4

0

I would suggest storing stuff inside ServerStorage, not Lighting

2 answers

✓ Accepted answer

index is literally the current index the table is at -- it's just a number. You don't want to re-parent a number, you want to re-parent the object.

child.Parent = game.Lighting

Although you really shouldn't use Lighting for storage. Roblox provides ServerStorage and ReplicatedStorage services for such things.

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