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

How do you get the player's torso using a local script?

how do you get the player's torso with a local script, I tried using function but it did not work what do I do

script:

button.MouseButton1Click:Connect(function(player)
	local torso = player.Character:FindFirstChild("UpperTorso")
	print(torso.Name)
end)

1 answer

✓ Accepted answer

Hello.

If you are using a LocalScript you would want to get the player before the Button is clicked. You would want to also get the character, as the player loads in before the character can. Try out this very simple script:

local Player = game:GetService("Players").LocalPlayer -- Gets the player
local Character = Player.Character or Player.CharacterAdded:Wait() -- Makes sure that the character is actually present before continuing

local Button = script.Parent -- I do not know where your button is located so I'll assume the script is located in the button.

Button.MouseButton1Click:Connect(function()
	local Torso = Character:WaitForChild("UpperTorso")
  print(Torso)
end)

Hope this helps!

2 comments

0

BTW If your game is R6 try change UpperTorso to just Torso

0

Ah yes, that as well

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