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)```