#How do I refer to a character's accessories and decals here?

1 messages · Page 1 of 1 (latest)

autumn roost
#

when trying to refer to my character's accessory "Pink Hair", it doesn't change anything about the hair when testing the function. same goes for the decal.
sorry if this is really obvious, i can't find anything to answer my question on dev forums, documentation, and just in general. please be patient, i'm very very new

bronze bridge
#

are you trying to find all accessories or just yours for your avatar?

#

like is this a personal script

bronze bridge
autumn roost
#

i can send the full snippet thing if needed

#

i presumed it was like, a syntax kind of thing and not really needed to include more than the screenshot 😭

bronze bridge
#

lol you can copy and paste, and then discord will give you an option to upload as a file if its too long

#

i think i misunderstood

#

anyway, i'm not seeing any refrences to the hair in the screenshot

autumn roost
#

like i just put Character:WaitForChild("Pink Hair").Transparency = 1

bronze bridge
#

you can do

Character:WaitForChild("Pink Hair"):FindFirstChild("Handle").Transparency = 1

accessories don't have a transparency value, you can see this when clicking on the accessory there is not such value, so you need to access the mesh and set the value there

[image shows no transparency option]

#

though i have better more optimal suggestion :D are you trying to make the entire character invisible?

#

forgot the other screenshot

autumn roost
bronze bridge
#

odd, maybe i can help make one that works lol

bronze bridge
#

was it a box that stuck to the torso?

autumn roost
#

yeah, aswell as all of the other limbs

#

a lot more obvious in the torso because of the r6 woman waist but you could see the clipping of parts in the arms and legs

bronze bridge
#
local character = game.Workspace.KyameronKing_Rig

-- you can loop through the character

local function changeTransparency() -- we can wrap it in a function you can call
    
    for _, parts in pairs(character:GetChildren()) do -- get the children of the character (everything inside, such as body parts, scripts, accessories, etc)
    
        if parts:IsA("BasePart") and parts.Name ~= "HumanoidRootPart" then -- you can also add "or parts:IsA("MeshPart") if your body parts are mesh, avoiding the hum root part!
            parts.Transparency = 1
        elseif parts:IsA("Accessory") then -- if its an accessory, then we access the mesh/part of it to change the trasnparency
            parts:FindFirstChild("Handle").Transparency = 1
        end
        
        if parts.Name == "Head" then
            if parts:FindFirstChildWhichIsA("Decal") then
                parts:FindFirstChildWhichIsA("Decal").Transparency = 1 -- if the head has a decal (face), we can change the transparency
            end
        end
    
    end
        
end -- end of callable function


--[[

you could call this by doing changeTransparency(),
but a ever better way would be making it to where
you can call it to change the transparency to any given
value, without having the make ANOTHER callable function
like the one above


so here is a EVER BETTER way to do this

]]-------------------------------------------
#
local character = game.Workspace.KyameronKing_Rig

local function change_Transparency(transpValue) -- litterally just the same thing, but we replace all transparacy values to a variable

    for _, parts in pairs(character:GetChildren()) do -- get the children of the character (everything inside, such as body parts, scripts, accessories, etc)

        if parts:IsA("BasePart") and parts.Name ~= "HumanoidRootPart" then -- you can also add "or parts:IsA("MeshPart") if your body parts are mesh, avoiding the hum root part!
            parts.Transparency = transpValue
        elseif parts:IsA("Accessory") then -- if its an accessory, then we access the mesh/part of it to change the trasnparency
            parts:FindFirstChild("Handle").Transparency = transpValue
        end

        if parts.Name == "Head" then
            if parts:FindFirstChildWhichIsA("Decal") then
                parts:FindFirstChildWhichIsA("Decal").Transparency = transpValue -- if the head has a decal (face), we can change the transparency
            end
        end

    end
    
end

--[[

when you call this one, you can give the function a value for the transparency, like this
change_Transparency(1) -- this will make the character invisible
change_Transparency(0) -- this will make the character visible
the number inside the () will be the transparency value :D

]]--
#

i havnt tested it so lemme do that quickly

#

^ explanation of a function you can use, not a copy-paste fix lol

#

i used the second fuction and set my characters transparency to 0.5 like change_Transparency(0.5)

#
-- another option if you're looking to get specific 
local character = game.Workspace.KyameronKing

local function change_Transparency(bodyParts, accessories, decals) -- we can get specific and even set different values for each one

    for _, parts in pairs(character:GetChildren()) do -- get the children of the character (everything inside, such as body parts, scripts, accessories, etc)

        if parts:IsA("BasePart") and parts.Name ~= "HumanoidRootPart" then -- you can also add "or parts:IsA("MeshPart") if your body parts are mesh, avoiding the hum root part!
            parts.Transparency = bodyParts
        elseif parts:IsA("Accessory") then -- if its an accessory, then we access the mesh/part of it to change the trasnparency
            parts:FindFirstChild("Handle").Transparency = accessories
        end

        if parts.Name == "Head" then
            if parts:FindFirstChildWhichIsA("Decal") then
                parts:FindFirstChildWhichIsA("Decal").Transparency = decals -- if the head has a decal (face), we can change the transparency
            end
        end

    end
    
end
#

note that if you do this in a local script, it only makes changes for the client, they may see themselves/or the character as invisble but the server/other players will still see them as visible