Advertisement
RobBobDev

Fully Functionable Minigame System

Apr 24th, 2022
956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. SCRIPT 1. STARTERGUI
  2.  
  3. local status = game.ReplicatedStorage:WaitForChild("Status")
  4. local text = script.Parent:WaitForChild("StatusText")
  5.  
  6. status:GetPropertyChangedSignal("Value"):Connect(function()
  7.     text.Text = status.Value
  8. end)
  9.  
  10. SCRIPT 2. SERVERSCRIPTSERVICE
  11.  
  12. local status = game.ReplicatedStorage.Status
  13. local text = game.StarterGui.GameStatus.StatusText.Text
  14. local players = game.Players
  15.  
  16. local map = game.Workspace.Map
  17. local spawnPoint = game.Workspace.SpawnLocation
  18. local weapons = game.ReplicatedStorage.Weapons
  19.  
  20. local intermission = 10
  21. local roundLength = 10
  22.  
  23.  
  24. players.PlayerAdded:Connect(function(plr)
  25.    
  26.     while true do
  27.         -- Counts down the intermission
  28.     for i = intermission, 0, -1 do
  29.         status.Value = "Intermission:".. i
  30.             wait(1)
  31.            
  32.         end
  33.         -- Gets players ready for the game to start
  34.         status.Value = "Starting!"
  35.         wait(3)
  36.        
  37.         plr.Character.HumanoidRootPart.CFrame = map.CFrame
  38.         local swordClone = weapons.ClassicSword:Clone()
  39.        
  40.         swordClone.Parent = plr.Character
  41.        
  42.         -- Counts down the round length
  43.         for i = roundLength, 0, -1 do
  44.             status.Value = "Time: ".. i
  45.             wait(1)
  46.         end
  47.        
  48.         status.Value = "Game Over!"
  49.         swordClone:Destroy()
  50.         wait(3)
  51.        
  52.     plr.Character.HumanoidRootPart.CFrame = spawnPoint.CFrame
  53.     task.wait(1)
  54.         end
  55.     end)
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement