Advertisement
Primal_Dev

Main Script

Oct 3rd, 2022
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. --- Variables ---
  2.  
  3. local Lobby = game.Workspace.Lobby
  4. local Maps = game.ReplicatedStorage.Maps:GetChildren()
  5. local Status = game.ReplicatedStorage.Values.Status
  6. local remotes = game.ReplicatedStorage:WaitForChild("Remotes")
  7.  
  8. local MapName = game.ReplicatedStorage.Values:WaitForChild("MapName")
  9. local MapImage = game.ReplicatedStorage.Values:WaitForChild("MapImage")
  10. local MapColor = game.ReplicatedStorage.Values:WaitForChild("MapColor")
  11.  
  12. --- Game Loop ---
  13.  
  14.  
  15.  
  16. while true do
  17.  
  18.     --- Intermission ---
  19.  
  20.     for i = 10, 0, -1 do
  21.         Status.Value = "Intermission: "..i
  22.         task.wait(1)
  23.     end
  24.  
  25.     --- Map Chooser ---
  26.  
  27.     local ChosenMap = Maps[math.random(1, #Maps)]
  28.     local ClonedMap = ChosenMap:Clone()
  29.  
  30.  
  31.  
  32.     ClonedMap.Parent = game.Workspace
  33.     MapName.Value = ChosenMap.Name
  34.     MapImage.Value = ChosenMap.ImageId.Value
  35.     MapColor.Value = ChosenMap.Color.Value
  36.     remotes.Visible:FireAllClients()
  37.     for i = 10, 0, -1 do
  38.         Status.Value = "Teleporting In: "..i
  39.         task.wait(1)
  40.     end
  41.  
  42.     --- Teleport To Map ---
  43.  
  44.     for i, Player in pairs(game.Players:GetPlayers()) do
  45.  
  46.         local Character = Player.Character
  47.  
  48.         if Character then
  49.  
  50.             local HumanoidRootPart = Character.HumanoidRootPart
  51.  
  52.             HumanoidRootPart.CFrame = ClonedMap.SpawnPoint.CFrame
  53.  
  54.         end
  55.     end
  56.  
  57.     --- Game ---
  58.  
  59.     for i = ChosenMap.Time.Value, 0, -1 do
  60.         Status.Value = "Game Ends In: "..i
  61.         task.wait(1)
  62.     end
  63.  
  64.  
  65.     remotes.Invisible:FireAllClients()
  66.     MapName.Value = ""
  67.     MapImage.Value = ""
  68.  
  69.  
  70.     --- Teleport To Lobby ---
  71.  
  72.  
  73.  
  74.  
  75.     for i, Player in pairs(game.Players:GetPlayers()) do
  76.  
  77.         local Character = Player.Character
  78.  
  79.         if Character then
  80.  
  81.             local HumanoidRootPart = Character.HumanoidRootPart
  82.  
  83.             HumanoidRootPart.CFrame = Lobby.Spawn.CFrame
  84.  
  85.         end
  86.     end
  87.  
  88.  
  89.     --- Destroy Map ---
  90.  
  91.     ClonedMap:Destroy()
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement