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

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

Asked by 9 years ago

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?

1
child.Parent = game.Lighting -- Just this on line 4 DataStore 530 — 9y
0
I would suggest storing stuff inside ServerStorage, not Lighting groovydino 2 — 9y

2 answers

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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.

Ad
Log in to vote
0
Answered by 9 years ago

Thanks for the help guys! It finally works :D

Answer this question