How to reference a specific player in a team?

Basically I’m making a sort of King of the Hill type game and I need help referencing the “King”

How I’m doing this is that there’s two teams, a king, and players. Basically I have a part that when touched by a player, turns them into the king and moves them into place. However i’m unsure on how I would be able to reference the king themselves. Would there be a way to pick out a player in the “King” team?

image

(Note: Id have it so there’s only one person allowed in the team, and when another player touched the part the king gets swapped out for another person.)

2 Likes

You can use GetPlayers() to reference players on a team. Example:

local Teams = game:GetService("Teams")
local Team_A = Teams:FindFirstChild("Team A")
local Players_On_Team_A = Team_A:GetPlayers()

print(Players_On_Team_A)
-- Player A, Player B, etc
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.