Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why won't my accessories become invisible?

my body parts do but when i become invisible all i see if my beard, hair etc. how do i fix that?

function setTransparency(char, value)
	
for _, child in pairs(char:GetChildren()) do
	
if child:IsA('Hat') and child:IsA("Accessory") and child:FindFirstChild("Handle")   then
	
child = child.Handle

elseif child:IsA("BasePart") and child.Name ~= "HumanoidRootPart"  then
	
child.Transparency = value
end
end
end
 
local enabled = true

game.Workspace.inva.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)

4 comments

0

You want to become invisible? Like all invisible :D???? If so I can help u

0

yes. the script works, i just need to help finding out why my hair, bear, etc isn't becoming invisible with my body parts. body parts become invisible but not the accessories for some reason.

0

sorry for the poor grammar, was typing a lil fast e.e

0

Try that :D I cannot really point out what is wrong with your script but this one should work :D

1 answer

local selectedTransparency

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
        delay(.5, function()
            --// Function delay to make sure the character has been added.
            if chr then
                for _,parts in pairs(chr:GetChildren()) do
                    wait()
                    if parts:IsA("BasePart") or parts:IsA("Part") or parts:IsA("MeshPart") or parts:IsA("GuiBase3d") or parts:IsA("Decal") then
                        selectedTransparency = 1
                        parts.Transparency = selectedTransparency
                        wait()
                    else
                    if parts:IsA("Accessory") then --// Ghost Mode
                        parts:Remove() --// Don't have to add this.
                    end
                    end
                    for _,parts_2 in pairs(parts:GetChildren()) do
                        if parts_2:IsA("Decal") then
                            parts_2.Transparency = 1 --// Will remove the face
                        end
                    end
                end
            end
        end)
    end)
end)

4 comments

0

that made the hole script not work.

0

it works but when i join. i want it to work when i touch a brick.

0

Ok

0

Change game.Players.PlayerAdded:Connect(function(plr) to script.Parent.Touched:Connect(function(hit) & Remove the chr added event and just use hit.Parent not chr

This discussion is preserved as it was. New answers, comments, and votes are closed.