Invisibility



Where to put this script


Put this code in as a script in the part you want to touch to activate invisibility

Invisibility


local TransPart = script.Parent

function setTransparency(char, value)
  for _, child in pairs(char:GetChildren()) do
  if child:IsA('Hat') and child:FindFirstChild("Handle") then
   child = child.Handle
  elseif child:IsA('BasePart') then
   child.Transparency = value
  end
 end
end
 
local enabled = true
TransPart.Touched:connect(function(hit)
 local char = hit.Parent
 if char then
  local head = char:FindFirstChild("Head")
  local face = head:FindFirstChild("face")
  if enabled and head and game.Players:GetPlayerFromCharacter(char) then
   enabled = false
   for t = 0, 1, .1 do
    if face then face.Transparency = t end
    setTransparency(char, t)
    wait(0.1)
   end
   wait(10)
   for t = 1, 0, -.1 do
    if face then face.Transparency = t end
    setTransparency(char, t)
    wait(0.1)
   end
   wait(2)
   enabled = true
  end
 end
end)

Line by Line

Customize