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

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

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)

5 comments

0

Yes, if your game is using R15 avatars, there is no torso. There is the Upper Torso and LowerTorso.

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.

0

Well when i put that in there isn't any errors but the brick turns invisible instead not me

0

The brick? Or the torso?

0

the brick turns invisible instead, not me

1 answer

✓ Accepted answer

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...

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