Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make accessories or hats invisible?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

0
Also I don't know what you're doing with the BasePart, most Handle's are just parts. JayShepherdMD 147 — 4y
0
With GetDescendants you're getting the Children of the Immediate Children, and I don't think any sub children are BaseParts. JayShepherdMD 147 — 4y
0
Hey are you still online? Sorry for the late reply lmao but it didnt work. ImUID3558 20 — 4y
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. ImUID3558 20 — 4y
Ad

Answer this question