wait(2)
maps = {74901977,74910340}
mr = 0
gametime = 180
waitrate = .5
m = Instance.new("Message",workspace)
function mapchange()
for i = 5,1,-1 do
wait(1)
m.Text = "Map Changing in "..i.."!"
end
m.Text = ""
if workspace:findFirstChild("Map") ~= nil then
workspace.Map:Remove()
end
repeat
wait()
mr = math.random(1,#maps)
until mr ~= workspace.mapnum.Value
main = game:GetService("InsertService"):LoadAsset(maps[mr])
main.Map.Parent = game.Workspace
main:Remove()
workspace.mapnum.Value = mr
end
function start()
mapchange()
spawns = workspace.Map.spawns:GetChildren()
ppl = game.Players:GetChildren()
for i = 1,#ppl do
ppl[i].TeamColor = game.Teams.Fighters.TeamColor
if ppl[i].Character ~= nil then
if ppl[i].Character:findFirstChild("Torso") ~= nil then
spawn = math.random(1,#spawns)
ppl[i].Character:MoveTo(spawns[spawn].Position)
end
end
end
end
function over()
ppl = game.Players:GetChildren()
for i = 1,#ppl do
ppl[i].TeamColor = game.Teams.Spectator.TeamColor
if ppl[i].Character ~= nil then
ppl[i].Character.Humanoid.MaxHealth = 100
ppl[i].Character.Humanoid.Health = 0
end
end
end
while wait() do
start()
workspace.Time.Value = gametime
repeat
wait(waitrate)
workspace.Time.Value = workspace.Time.Value - 1
until workspace.Time.Value <= 0
end
output says
19:40:08.501 - Workspace.Gamescript:18: bad argument #2 to '?' (string expected, got nil)
19:40:08.505 - Script 'Workspace.Gamescript', Line 18 - global mapchange
19:40:08.507 - Script 'Workspace.Gamescript', Line 28 - global start
19:40:08.508 - Script 'Workspace.Gamescript', Line 54
19:40:08.509 - Stack End
I tried game.Workspace[mapnum] = mr |