Help me get this invisibility tool to work

I made an invisibility tool for my game and it works on both R6 and R15 body parts, but the face and accessories of the player will remain visible because I have not been able figure out how to add those to the list of invisible parts.

Take this model and try to find a way to fix the issue: https://www.roblox.com/library/7337480227/InvisibilityTool-that-needs-fixing

If you can fix it for me then I’ll reward you with permanent admin in the game I will be using it for.

Inside the head is the face decal. Save the id and use it when you want to make the player visible again. Same with the hair/hats, clone it somewhere and remove it from the character then replace it onto the player when you want.

I tried to do something like this but it didn’t register.

local parts = {“Tool.Parent.Accessory.Handle”, “Tool.Parent.Head.face”}

What do you mean? Can you show me the whole script so I can understand better of whats going wrong?

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)

You should try looping through it like this, it should at least get rid of the hair :slight_smile:

local character = script.Parent

local setCharacterTransparency = function(transparency)
   for _, object in pairs(character:GetDescendants()) do
      if object.ClassName == 'Part' or object.ClassName == 'MeshPart' or object.ClassName == 'Union' then
         object.Transparency = transparency
      end
   end
end

Edit: This uses instance:GetDescendants() to ensure getting all of the descendants, not just the immediant children :slight_smile:

2 Likes

Can you show me where I need to put it in my script?

I just need to fix the script a bit now

Try disabling the current script you have and creating a new LocalScript under the tool with this in it. If it doesn’t work, re-enable the old script and tell me :slight_smile:

local tool = script.Parent

local character = script.Parent

local setCharacterTransparency = function(transparency)
   for _, object in pairs(character:GetDescendants()) do
      if object.ClassName == 'Part' or object.ClassName == 'MeshPart' or object.ClassName == 'Union' then
         object.Transparency = transparency
      end
   end
end

tool.Unequipped:Connect(function()
   setCharacterTransparency(0)
end)

tool.Equipped:Connect(function()
   setCharacterTransparency(1)
end)

Nope, it didn’t do anything with or without the old script.

When you are finished with it then just send a model of it back to me.

How the heck did you make it so the Accessory was invisible?

I made it so it makes the entire player model transparent instead of the body

1 Like

here it is

configure it to allow copying, I’m going to try this out.

the little ghost just vanishes after you use it the first time and won’t reappear

This would be great if my game was singleplayer but the local script doesn’t replicate for the server. Maybe you can fix it with a remote event or make it compatible with a normal script. The original issue is fixed as far as I’m concerned but it has to still work for a multiplayer server.

1 Like

Actually I think I may have fixed that on my own. All I had to do was paste all that into a normal script and change the first line into this.

local p = script.Parent.Parent.Parent

Now it finally works!

So you would use the Pivot thing?

You can have a copy of it if you want. InvisibilityTool WORKS! - Roblox

1 Like