Find the name of the Player in team

Im attempting to create a script where it checks the name of a player in the team. It’ll then print that value as the winner. I tried to create use this

game.Teams.Players:FindFirstChildOfClass(“Player”).Name

However it gives the error " [ServerScriptService.ServerControl:47: attempt to index nil with Name"

Is their an alternative to find the Player

You should be using Team:GetPlayers() instead

This doesn’t work in fact (30 Characters)

Are you looking for a script where it finds one individual player, or a script where you get the players in a certain team?

One player in one team. (30 Characters)

Players aren’t parented to teams. That’s why game.Teams.Players:FindFirstChildOfClass(“Player”) returns nil.

So you should use Team:GetPlayers(), this returns Player objects whose properties are equal to Team in an array.

e.g.:

local player

for i,plr in ipairs(Team:GetPlayers()) do
if plr.Name == SOME_NAME then
player = plr
break
end
end