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

How do i refer to the HumanoidRootPart of a 2nd Player?

Hello!

I'm trying to get the HumanoidRootPart of a player that isnt the LocalPlayer, however i dont know how i can refer to it

Small example of what im trying to do (obviously doesnt work)

local p1 = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local p2 = game.Players.Player2.Character:WaitForChild("HumanoidRootPart")

If possible, Player2 can be always the player 2 of the server, independent of the name.

Thank you and sorry for the inconveniences!

1 comment

0

How are you obtaining Player2?

1 answer





local p1 = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local p2 = workspace[p2.Name]:WaitForChild("HumanoidRootPart") -- if player2 is a variable then just do player2.Character etc
--game.Players.Player2.Character:WaitForChild("HumanoidRootPart")




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