-- Define Variables

local ReplicatedStorage = game:GetService('ReplicatedStorage')

local ServerStorage = game:GetService('ServerStorage')

local MapsFolder = ServerStorage:WaitForChild('Maps')

local status = ReplicatedStorage:WaitForChild('Status')

local GameLength = 120

--GameLoop

while true do

Status.Value = 'No enough players'

repeat wait(1) until game.Players.NumPlayers >= 2

Status.Value = 'Intermission'

wait(5)

local plrs = {}

for i, player in pairs(game.Players:GetPlayers()) do
	if player then
		table.insert(plrs,player)

end

end

wait(2)

local AvailableMaps = MapsFolder:GetChildren()
    
local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]

Status.Value = ChosenMap.Name..' Chosen'

local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace

-- teleport

local SpawnPoints = ClonedMap:FindFirstChild('SpawnPoints')

if not SpawnPoints then
	print('SpawnPoints Not Found!')

end

local AvailbleSpawnPoints = SpawnPoints:GetChildren()

for i, player in pairs (plrs) do
	if player then
		character = player.Character
	
		if character then
			-- teleport him
			character:FindFirstChild('HumanoidRootPart').CFrame = AvailableSpawnPoints[1].CFrame
			table.remove(AvailableSpawnPoints,1)

			--give sword

			local Sword = ServerStorage.Sword:Clone()
			Sword.Parent = player.Backpack

			local GameTag = Instance.new('BoolValue')
			GameTag.Name = 'GameTag'
			GameTag.Parent = player.Character
		else
			-- There is no character
			if not player then
				table.remove(plsr,i)

end end end end end

1 comment

0

Your status varible is supposed to have a lowercase 's' according to your script