Advertisement
facedwarrior193

RoundsSystem

Mar 17th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1.  
  2.  
  3.  
  4. function startround()
  5.     if #game.Players:GetChildren() >= 2 then
  6.         local Roundinprocess = true
  7.         for i = 1,5 do
  8.             game.StarterGui.ScreenGui.TextLabel.Text = "Starting round in "..i.." Seconds"
  9.         end
  10.         for i,v in pairs(game.Players:GetChildren()) do
  11.             local character = v.Character
  12.             if not character or not character.Parent then
  13.                 character = v.CharacterAdded:wait()
  14.             end
  15.             character.HumanoidRootPart.Position = Vector3.new(0,10,0)
  16.             local sword = game.ReplicatedStorage.ClassicSword:Clone()
  17.             sword.Parent = v.BackPack
  18.         end
  19.         while Roundinprocess == true do
  20.             wait(1)
  21.             local part = game.Workspace.region
  22.             local region3 = Region3.new(part.Position + Vector3.new(part.Position - (0.5 * part.Size),part.Position - (0.5 * part.Size)))
  23.             local partsinreason = workspace:FindPartsInRegion3(region3, part)
  24.            
  25.             local tableofparts = workspace:FindPartsInRegion3(region3, part)
  26.             local players = 0
  27.             for i , v in pairs(partsinreason) do
  28.                 if v:FindFirstChild("Humanoid") then
  29.                     players = players + 1
  30.                 end
  31.                 if players == 1 then
  32.                     Roundinprocess = false
  33.                 end
  34.             end
  35.         end
  36.     else
  37.         game.StarterGui.ScreenGui.TextLabel.Text = "Waiting for more players"
  38.     end
  39. end
  40. while wait(5) do
  41.     startround()
  42. end
  43.  
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement