local Tool = script.Parent;
enabled = true
local ghostChar = nil
function makeMeGhostly(trans)
if ghostChar == nil then return end
local parts = {"Head", "Torso", "Left Leg", "Right Leg", "Left Arm", "Right Arm", "UpperTorso", "LeftUpperLeg", "RightUpperLeg", "LeftUpperArm", "RightUpperArm", "LowerTorso", "LeftLowerLeg", "RightLowerLeg", "LeftLowerArm", "RightLowerArm", "LeftFoot", "RightFoot", "LeftHand", "RightHand"}
for i=1,#parts do
local p = ghostChar:FindFirstChild(parts[i])
if p ~= nil then p.Transparency = trans end
end
end
function UpdateGhostState(isUnequipping)
if isUnequipping == true then
makeMeGhostly(0)
ghostChar = nil
else
ghostChar = Tool.Parent
makeMeGhostly(1)
end
end
function onActivated()
if not enabled then
return
end
enabled = false
Tool.Handle.Transparency = 1
Tool.Handle.poof:Play()
local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
UpdateGhostState(false)
end
wait()
Tool.Handle.poof.Volume = 0
enabled = true
end
function onEquipped()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
function onUnequipped()
UpdateGhostState(true)
Tool.Handle.poof.Volume = 8
Tool.Handle.poof:play()
Tool.Handle.Transparency = 0
end
script.Parent.Unequipped:connect(onUnequipped)