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

Why is the Torso in my GetChildren/GetPlayer isn't working?

Asked by 5 years ago

Whenever I play and play the output always says there is something wrong with the torso, I don't know if it's r15 or something else

Here's the script:

script.Parent.Touched:connect(function()
    local player = game.Players:GetPlayers()    

    for i, v in pairs(player) do
        v.Character.Torso.Transparency = 0.5
    end



end)
0
Yes, if your game is using R15 avatars, there is no torso. There is the Upper Torso and LowerTorso. Crazycat4360 115 — 5y
0
That is why your getting an error, there is no 'Torso' inside the player. Change v.Character.Torso to v.Character.UpperTorso and another one with v.Character.LowerTorso. Crazycat4360 115 — 5y
0
Well when i put that in there isn't any errors but the brick turns invisible instead not me paperking12 20 — 5y
0
The brick? Or the torso? Bilinearly 58 — 5y
0
the brick turns invisible instead, not me paperking12 20 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Try this:

script.Parent.Touched:connect(function()
    local player = game.Players:GetPlayers()    
    for i, v in pairs(player) do
        if v.Character.Humanoid.Rig =="R15" then
            v.Character.UpperTorso.Transparency = 0.5
            v.Character.LowerTorso.Transparency = 0.5
        else
            v.Character.Torso.Transparency = 0.5
    end
end)

Compatible with both r15 and r6.

If you mean your entire character:

script.Parent.Touched:connect(function()
    local player = game.Players:GetPlayers()    
    for i, v in pairs(player) do
        char = v.Character:GetDescendants()
            for o = 1,#char do
                 if char[o]:IsA('MeshPart') or char[o]:IsA('UnionOperation') or char[o]:IsA('Part') then
                     char[o].Transparency = 0.5
                 end
            end
    end
end)

tbh helping with a mobile device is a hassle. i just woke up minutes ago... i feel lazy to open my laptop...

Ad

Answer this question