This script works 100% fine. But the thing is when I try and make the hats on the local player this tool is inside of, it only makes 1 of there hats transparency = 1. I am wanting to make all of the hats they have transparency = 1.
This is my script: [Line 22-24] & [Line 36-38]
local mouse = game.Players.LocalPlayer:GetMouse()
function Light()
local player = game.Players.LocalPlayer
local playerChar = player.Character
local playerLight = playerChar.Torso:FindFirstChild("Light")
if playerLight then
playerLight:Destroy()
else
local humanoid = playerChar:findFirstChild("Humanoid")
if humanoid == nil then return end
playerChar:findFirstChild("Head").Transparency = 0.98
playerChar:findFirstChild("Torso").Transparency = 0.98
playerChar:findFirstChild("Left Arm").Transparency = 0.98
playerChar:findFirstChild("Right Arm").Transparency = 0.98
playerChar:findFirstChild("Left Leg").Transparency = 0.98
playerChar:findFirstChild("Right Leg").Transparency = 0.98
playerChar:findFirstChild("Head"):findFirstChild("face").Transparency = 1
for i, d in pairs (playerChar:GetChildren()) do
if d.className == "Hat" then
d.Handle.Transparency = 1
wait(10)
playerChar:findFirstChild("Head").Transparency = 0
playerChar:findFirstChild("Torso").Transparency = 0
playerChar:findFirstChild("Left Arm").Transparency = 0
playerChar:findFirstChild("Right Arm").Transparency = 0
playerChar:findFirstChild("Left Leg").Transparency = 0
playerChar:findFirstChild("Right Leg").Transparency = 0
playerChar:findFirstChild("Head"):findFirstChild("face").Transparency = 0
for i, d in pairs (playerChar:GetChildren()) do
if d.className == "Hat" then
d.Handle.Transparency = 0
script.LocalScript.Disabled = true
wait(0.000005)
player.PlayerGui.InvisibleAbility:Destroy()
script:Destroy()
end
end
end
end
end
end
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "e" then
Light()
end
end)
