I want a map to spawn everytime a game ends or when the entire players team is empty. I tried to use this script...
local team = game.Teams.Players
local map = game.ReplicatedStorage.ParkMap
if team.??? = 0 then
map:Clone(194, 37, 29.2)
I want a map to spawn everytime a game ends or when the entire players team is empty. I tried to use this script...
local team = game.Teams.Players
local map = game.ReplicatedStorage.ParkMap
if team.??? = 0 then
map:Clone(194, 37, 29.2)
if team.??? = 0 then. To check if a team is empty, you get the number of players and compare it with 0, like this: if #team:GetPlayers() == 0 thenHere's the solution:
local team = game.Teams.Players
local map = game.ReplicatedStorage.ParkMap
-- check if a team has 0 players
if #team:GetPlayers() == 0 then
-- clone the map, and put it in workspace
map:Clone().Parent = workspace
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
"team.??? = 0"? I think you should do "if #team.???:GetPlayers() = 0 then"
Also, instead of "map:Clone(194, 37, 29.2)", try "map:Clone() map:SetPrimaryPartCFrame(194, 37, 29.2)"