I have this invisibility power-up that makes players invisible, but the tool the player is holding doesn't. therefore I made this script but it doesn't work. it's only a little part of the script:
for _,v in pairs(game.Players:GetChildren(player.Backpack:GetChildren())) do
if v.ClassName == "Tool" then
v.Handle.Transparency = 1
this is the whole script
local debounce = false
function onTouched(hit)
if hit.Parent then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if debounce then return end
debounce = true
script.Parent.ScreenGui:Clone().Parent = player.PlayerGui
script.Parent.PickUp:Play()
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,100,0)
player.Character.Torso.Transparency = 1
player.Character.Head.Transparency = 1
player.Character["Left Arm"].Transparency = 1
player.Character["Right Arm"].Transparency = 1
player.Character["Left Leg"].Transparency = 1
player.Character["Right Leg"].Transparency = 1
player.Character.Torso.Trail.Enabled = false
player.Character.Head.Face.Transparency = 1
for _,v in pairs(game.Players:GetChildren(player.Backpack:GetChildren())) do
if v.ClassName == "Tool" then
v.Handle.Transparency = 1
wait(10)
--will do the rest
wait(200)
debounce = false
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-100,0)
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
every thing works BUT the tool transparency modifier, any help?

5 comments
Do you include any other model, mesh, part,... in the tool?
i just want to grab the Handle of the tool and change its transparency. there are indeed other children in the tool, but those i dont need to modify.
Theres only 1 union in the tool called Handle, no other 3D objects.
Wait, you have a player instance in the first place, why you need to loop though the table of players.
And why you need to check the children of the backpack is a tool or not. It better to check is that the "invisible tool", so the player can't not be invisible with the different tool in the backpack.