Joriangames

Random map with intermission script

Jan 29th, 2021 (edited)
4,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. --Thanks for using this script
  2. --This script is made by Joriangames/Problox Studio Scripts
  3. --Want to know how to use this? Watch my tutorial: https://www.roblox.com/library/6316459099/Random-map-with-intermission
  4.  
  5. local maps = game:GetService("ServerStorage").Maps:GetChildren()
  6. local Title = game.StarterGui.MapSelector.Title
  7. local spawns = game.Workspace.Spawns:GetChildren()
  8. local status = game.ReplicatedStorage.Status
  9. ti = 0
  10.  
  11. while true do
  12.     ti = 10
  13.     repeat
  14.         ti = ti -1
  15.         status.Value = "Intermission "..ti
  16.         wait(1)
  17.     until ti == 0
  18.    
  19.     local randomMap = maps[math.random(1, #maps)]
  20.     randomMap:Clone().Parent = workspace
  21.     current = randomMap.Name
  22.    
  23.     status.Value = "Chosen game is "..randomMap.Name
  24.     wait(5)
  25.     status.Value = "Loading game!"
  26.     wait(2)
  27.     status.Value = "Starting game!"
  28.     wait(2)
  29.     local plrs = game.Players:GetChildren()
  30.    
  31.     for i = 1, #plrs do
  32.         local randomSpawn = spawns[math.random(1, #spawns)]
  33.         plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(randomSpawn.Position)
  34.     end
  35.    
  36.     ti = 10
  37.     repeat
  38.         ti = ti -1
  39.         status.Value = ti.." seconds left!"
  40.         wait(1)
  41.     until ti == 0
  42.     for i = 1, #plrs do
  43.         plrs[i].Character.HumanoidRootPart.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0, 10, 0)
  44.     end
  45.    
  46.     workspace[current]:Destroy()
  47. end
Add Comment
Please, Sign In to add comment