Finding other players humanoid root part

I was trying a magnitude combat script and I was wondering how to find other players humanoid root part via script. I know I have to check how close I want the player humanoid rootpart, but how do I check both players humanoid rootpart and other player humanoid rootpart? Thanks!

How are you finding which players?

local distance = (player1.Character.HumanoidRootPart.Position - player2.Character.HumanoidRootPart.Position).Magnitude

I just get a table of all the players on the server. Problem I have with this though is that it will probably get the player that is using the combat, I don’t want the player that is using it to be damaged aswell

Yeah thats why you will place checks too see if the player’s HumanoidRootPart is the one it found if it is well then, you know dont damage :blush:

I read that and automatically realized what to do, thank you! I didn’t think of that.

1 Like

I don’t think it works with NPCs, because I’m using the players:GetChildren, it only targets players and not NPCs any help?

You have to do game.Workspace :blush:

Is there anyway I can do both?