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

How do I make accessories or hats invisible?

I want to make a script that turns the player invisible, but everything other than the hat is not being invisible. When in the explorer, if I just press the Handle of the accessory and change transparency to 1, it get's invisible, but for some odd reason it wont in this for loop

for i, v  in pairs(character:GetDescendants()) do
	if v:IsA('BasePart') then
		physics:SetPartCollisionGroup(v, 'Player')
		v.Transparency = 1
	elseif v:IsA('Decal') then
		v.Transparency = 1
	end
end

I've tried other things too. I checked if v:IsA('Accessory') then did v.Handle.Transparency = 1, I tried if v.Name == 'Handle', and I also tried what is above, if v:IsA('BasePart').

1 answer

I'm not exactly sure what' you're doing wrong but try this!

for _,v in pairs(Character:GetChildren()) do
	if v.ClassName == "Accessory" then
		v.Handle.Transparency = 1
	end
end

I can't tell if it's the descendant's function messing you up, or the collision group.

4 comments

0

Also I don't know what you're doing with the BasePart, most Handle's are just parts.

0

With GetDescendants you're getting the Children of the Immediate Children, and I don't think any sub children are BaseParts.

0

Hey are you still online? Sorry for the late reply lmao but it didnt work.

0

I heard that BaseParts are all parts, so thats why I used BaseParts. The collision group works fine, the only issue is the accessory being messed up.

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