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

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

Asked by 2 years ago

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!

0
How are you obtaining Player2? COUNTYL1MITS 312 — 2y

1 answer

Log in to vote
0
Answered by
A_Mp5 222 Moderation Voter
2 years ago




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")
Ad

Answer this question