✓ Accepted answer
You have to link the functions to the Equipped and Activate events (and also move your ends around):
local tool = script.Parent
local function onActivate()
local char = tool.Parent.Parent
char.Head.Transparency = 1
char['Right Arm'].Transparency = 1
char['Left Arm'].Transparency = 1
char.Torso.Transparency = 1
char['Right Leg'].Transparency = 1
char['Left Leg'].Transparency = 1
end
tool.Activated:Connect(onActivate)
local function onUnequip()
local char = tool.Parent.Parent
char.Head.Transparency = 0
char['Right Arm'].Transparency = 0
char['Left Arm'].Transparency = 0
char.Torso.Transparency = 0
char['Right Leg'].Transparency = 0
char['Left Leg'].Transparency = 0
end
tool.Unequipped:Connect(onUnequip)
But a better way to do it might be to iterate through the children of the character and set the transparency of all the parts to 0/1:
function setTransparency(trans)
local char = script.Parent.Parent
for _,v in pairs(char:GetDescendants()) do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
v.Transparency = trans
end
end
end
script.Parent.Equipped:Connect(function()
setTransparency(1)
end)
script.Parent.Unequipped:Connect(function()
setTransparency(0)
end)