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

How do I transparency?

Asked by 10 years ago

So I am making my script and I need transparency. So it works fine with head and torso but how do I make it work on Arms or Legs? I tryed something like LeftArm(Hand)

works fine with the main parts:

game.Workspace.[Name].[Part].Transparency = 0.5

Btw I don't know what tag should I add here

0
Thank you, that was really helpful. This topic is solved! :D rimvosiusLOST 5 — 10y

2 answers

Log in to vote
1
Answered by
Thetacah 712 Moderation Voter
10 years ago

Pretty simple :

character["Right Leg"].Transparency = .8
character["Left Leg"].Transparency = .8

Anywho, you could do this if you want all to be .5

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(character)
for i , v in pairs(character:GetChildren()) do
    if v:IsA("BasePart") then
    v.Transparency = .8
            end
        end
    end)
end)
Ad
Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Since names with spaces like Left Arm aren't valid identifiers (they aren't a variable name since they have a space in them) we can't use the . to index them.

Instead, we use explicit indexing using the square brackets

character["Left Arm"].Transparency.

We can compare this to character["Head"].Transparency and character.Head.Transparency

Answer this question