I'm trying to make an invisibility tool that makes your entire body turn invisible, then turn visible again, but for some reason it's not functioning how I would like.
local tool = script.Parent local debounce = false function onButton1Down(mouse) if debounce == false then debounce = true local player = game.Players.LocalPlayer for _,m in ipairs(player.Character:GetChildren()) do if m.className == "Hat" then m.Handle.Transparency = 1 end if m.className == "Part" then m.Transparency = 1 end wait(1) for _,mm in ipairs(m:GetChildren()) do if mm.ClassName == "Decal" then mm.Transparency = 1 end wait(5) if mm.ClassName == "Decal" then mm.Transparency = 0 end end if m.className == "Hat" then m.Handle.Transparency = 0 end if m.className == "Part" then m.Transparency = 0 end end debounce = false end end function onSelected(mouse) mouse.Icon = "rbxasset://textures\\ArrowCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end tool.Selected:connect(onSelected)
Using wiki.roblox.com we can see the members of a "tool,
tool.Selected:connect(onSelected)
is not a valid member becuase you would need to use
Tool.Equipped (when the tool is selected and the mouse is clicked) or Tool.Activated (when the tool is selected)