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

Test if a play is on a certain team? [closed]

Asked by
birds3345 177
5 years ago

So, in my game I need to test if a player is on a certain team. Can anyone help me with this?

Thanks

Closed as Not Constructive by User#5423

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Team Property of Player Objects


In Roblox, player objects have a Team property that is whatever team they are on. So, to see whether if a player is on a certain team, you would simply check if the Team property of a given player is the team you desire.

lua local teamname = "SomeThing" local plr = ... if plr.Team == game.Teams[teamname] then print("player on the team") end

Hopefully this helped! Be sure to accept if it did!

0
note that the teamname variable is there to avoid confusion theking48989987 2147 — 5y
Ad