Help on tool activation

Does anyone know how I could make it so when I click to go invisible I can click again to go un-invisible?

1 Like

I wrote a script for you.

local Tool = script.Parent
local Invisible = false

Tool.Activated:Connect(function()
	local Character = script.Parent.Parent
	
	if Invisible == false then 
		Invisible = true
		for i,v in pairs(Character:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("Decal") then
				if v.Name ~= "HumanoidRootPart" then
					v.Transparency = 1
				end
			end
		end
	elseif Invisible == true then
		Invisible = false
		for i,v in pairs(Character:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("Decal") then
				if v.Name ~= "HumanoidRootPart" then
					v.Transparency = 0
				end
			end
		end
	end
end)

This script should go directly inside the tool.
Be sure that the tools RequiresHandle property is set to off.

2 Likes