I'm trying to make a horror game where four survivors must complete four tasks and enter a safe room, while being pursued by a monster. I want one player at random to be chosen as the monster, while four others have to be the survivors. I used this script to do so, and I made the "Survivors" team auto-assignable. The script doesn't work in studio or in game.
local monster = game.Teams.Monster
local Players = game:GetService("Players")
function onPlayerAdded(player)
local mon = monster:GetPlayers()
if mon == 0 then
player.TeamColor = BrickColor.new("Really red") --team color of monster
end
end
Players.PlayerAdded:connect(onPlayerAdded)
for _,player in pairs(Players:GetPlayers()) do --I read on the wiki that studio loads players before scripts, this accounts for that.
onPlayerAdded(player)
end
Any help? Thanks.
