Teams is not a valid member of Player

Hey I’m trying to make it so that my script assigns players to a specific team if they are chosen.

However, I’m getting this error.
Teams is not a valid member of Player

How do I fix this?

---LOCAL SCRIPT---
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local getPlayers = Players:GetPlayers()

local Teams = game:GetService("Teams")

local roleEvent = game.ReplicatedStorage.RoleEvent

roleEvent.OnClientEvent:Connect(function()
	
	local chosen = Players:GetChildren()[math.random(1, #Players:GetChildren())]
	warn("Hi it worked")
	chosen.Teams = Teams.Drawer
	print(chosen.Name.. " is the drawer!")
	chosen.PlayerGui.RoundGui.RoleFrame.Visible = true
	
	for i, player in pairs(Players:GetChildren()) do
		
		if player ~= chosen then
			
			print(player.Name.. " is a guesser!")
			player.PlayerGui.RoundGui.RoleFrame.Visible = true
			
		end
		
	end
	
end)```
1 Like

The property of a player’s team is called “player.Team” and not “player.Teams”. Just remove the “s” and it should work :+1:

1 Like

ahhh, what a simple mistake. Thank you so much!

1 Like

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