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.
01 | local tool = script.Parent |
02 | local othertool = game.Lighting |
03 | local function onActivate() |
04 | local char = game.Players.LocalPlayer.Character |
05 | for _, obj in pairs (char:GetChildren()) do |
06 | if obj:IsA( "Accoutrement" ) then |
08 | char.Head.face.Parent = tool |
09 | tool.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 |
19 | tool.Activated:Connect(onActivate) |
20 | local function onUnequip() |
21 | local char = game.Players.LocalPlayer.Character |
22 | tool.face.Parent = char.Head |
23 | tool.Handle.Transparency = 0 |
24 | char.Head.Transparency = 0 |
25 | char [ 'Right Arm' ] .Transparency = 0 |
26 | char [ 'Left Arm' ] .Transparency = 0 |
27 | char.Torso.Transparency = 0 |
28 | char [ 'Right Leg' ] .Transparency = 0 |
29 | char [ 'Left Leg' ] .Transparency = 0 |
31 | tool.Unequipped:Connect(onUnequip) |