Advertisement
HowToRoblox

GameSelector

Dec 8th, 2019
4,922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. local Minigames = game:GetService("ServerStorage"):WaitForChild("Minigames"):GetChildren()
  2.  
  3. while true do
  4.    
  5.     wait(4)
  6.    
  7.     local minigame = Minigames[math.random(1,#Minigames)]:Clone()
  8.    
  9.     local spawns = minigame.Minigame.Spawns:GetChildren()
  10.    
  11.     minigame.Minigame.Parent = workspace
  12.    
  13.     local plrs = game:GetService("Players"):GetChildren()
  14.    
  15.     local plrsalive = {}
  16.    
  17.     for i,plr in pairs(plrs) do
  18.         if plr.Character then
  19.             plr.Character:FindFirstChild("HumanoidRootPart").CFrame = spawns[i].CFrame + Vector3.new(0,10,0)
  20.             table.insert(plrsalive, plr)
  21.             local tag = Instance.new("BoolValue", plr.Character)
  22.             tag.Name = "Alive"
  23.         end
  24.     end
  25.    
  26.    
  27.     if minigame.Name == "SpinnerMinigame" then
  28.         for i = 1, 3000 do
  29.             wait(0.01)
  30.             workspace.Minigame:WaitForChild("Spinner").Orientation = Vector3.new(0, workspace.Minigame.Spinner.Orientation.Y + i/160, 0)
  31.            
  32.             workspace.Minigame.Lava.Touched:Connect(function(touch)
  33.                 if touch.Parent:FindFirstChild("Humanoid") then
  34.                     touch.Parent:FindFirstChild("Humanoid").Health = 0
  35.                     for i = 1,#plrsalive do
  36.                         if plrsalive[i].Name == touch.Parent.Name then
  37.                             table.remove(plrsalive, i)
  38.                         end
  39.                     end
  40.                 end
  41.             end)
  42.            
  43.            
  44.             workspace.Minigame.Spinner.Touched:Connect(function(touch)
  45.                 if touch.Parent:FindFirstChild("Humanoid") then
  46.                     touch.Parent:FindFirstChild("Humanoid").Health = 0
  47.                     for i = 1,#plrsalive do
  48.                         if plrsalive[i].Name == touch.Parent.Name then
  49.                             table.remove(plrsalive, i)
  50.                         end
  51.                     end
  52.                 end
  53.             end)
  54.             if #plrsalive == 0 then
  55.                 break
  56.             end
  57.         end
  58.     end
  59.    
  60.    
  61.     workspace.Minigame:Destroy()
  62.    
  63.     local plrs = game:GetService("Players"):GetChildren()
  64.    
  65.     for i, plr in pairs(plrs) do
  66.         plr:LoadCharacter()
  67.     end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement