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

How to get all childrens of Lighting?

Asked by 7 years ago
Edited 7 years ago

So. I have a localscript inside a tool that hides the player when he clicks and and unhides him when he unequips it. To hide the hats, I move them all into Lighting however I don't know any quick method to get them back.

01local tool = script.Parent
02local othertool = game.Lighting
03local function onActivate()
04    local char = game.Players.LocalPlayer.Character
05    for _, obj in pairs(char:GetChildren()) do
06            if obj:IsA("Accoutrement") then
07obj.Parent = othertool
08char.Head.face.Parent = tool
09tool.Handle.Transparency = 1
10    char.Head.Transparency = 1
11    char['Right Arm'].Transparency = 1
12    char['Left Arm'].Transparency = 1
13    char.Torso.Transparency = 1
14    char['Right Leg'].Transparency = 1
15    char['Left Leg'].Transparency = 1
View all 31 lines...

1 answer

Log in to vote
0
Answered by 7 years ago

To get all of the children of something, you can just use :GetChildren(). Example:

1game.Lighting:GetChildren()
0
Thanks. I'll try eloiishot 47 — 7y
Ad

Answer this question