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

How to make player accessories invisible?

I'm making a script where a player turns invisible when they activate a tool. I am able to make their BaseParts invisible (arms, legs torso.. etc), but their hats/glasses stay on.

for i, v in pairs (kinder) do
	local transparent = 1
		if v:IsA("BasePart") or v:IsA("Accessory")then
			v.Transparency = transparent
		end
end

kinder is a table of the character's children.

In this code, the error message is: Transparency is not a valid member of Accessory.

Is there any way to make the player fully invisible, including accessories?

1 comment

0

if it worked, could you make my answer a solution

1 answer

✓ Accepted answer
for _, player in pairs(game.Players:GetPlayers()) do
    local character = player.Character

    for _, descendant in pairs(character:GetDescendants()) do
        if descendant:IsA("BasePart") then 
            descendant.Transparency = 1
        end
    end
end

5 comments

0

Thank you, that worked perfectly. Is there a reason GetDescendants() works rather than GetChildren()?

0

GetDescendents get all the children in childrens inside the parts and getchrilden dont i believe

0

if it worked, could you make this a solution

0

Because I have it in a local script inside of a tool, I found out that the invisibility is only local to the client; the server can still see a visible player. Do you know how to make the invisibility server-sided so that all players can see it? I tried moving it into a regular script and changing the Character to script.Parent.Parent, but the entire script is not firing, like Tool.Activated.

0

Use remotevents.

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