Z_Dev

game

Dec 24th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. -- Services
  2.  
  3. local replicatedStorage = game:GetService("ReplicatedStorage")
  4. local serverStorage = game:GetService("ServerStorage")
  5.  
  6. local values = replicatedStorage:WaitForChild("Values")
  7. local status = values:WaitForChild("Status")
  8.  
  9. local hitbox = serverStorage:WaitForChild("Hitbox")
  10. local iceBox = serverStorage:WaitForChild("IceBox")
  11.  
  12. local map = workspace.Map
  13.  
  14. local contestants = {}
  15.  
  16. -- Functions
  17.  
  18. local function issoldier(plr)
  19. for _, v in pairs(contestants) do
  20. if v == plr then
  21. return true
  22. end
  23. end
  24.  
  25. return false
  26. end
  27.  
  28. local function kickOut(plr)
  29. for i, soldier in pairs(contestants) do
  30. if soldier == plr then
  31. table.remove(contestants,i)
  32. end
  33. end
  34. end
  35.  
  36. local function chooseTagger(plrs)
  37. return plrs[math.random(1,#plrs)]
  38. end
  39.  
  40. local function teleportPlayers(spawns)
  41. return spawns[math.random(1,#spawns)]
  42. end
  43.  
  44.  
  45. -- main
  46.  
  47. while wait(1) do
  48. contestants = {}
  49. repeat
  50. status.Value = "Not enough players start!"
  51. wait(1)
  52. print("not enough players!")
  53. until #game.Players:GetPlayers() >= 1
  54.  
  55. wait(1)
  56. status.Value = "New round starting!"
  57. for i, plr in pairs(game.Players:GetPlayers()) do
  58. if plr then
  59. table.insert(contestants,plr)
  60. end
  61. end
  62.  
  63. contestants = (game.Players:GetPlayers())
  64. wait(4)
  65. local chosenTagger = chooseTagger(contestants)
  66. status.Value = "The chosen tagger is "..chosenTagger.Name
  67. if issoldier(chosenTagger) then
  68. kickOut(chosenTagger)
  69. end
  70.  
  71. wait(3)
  72.  
  73. local spawns = teleportPlayers(map.Spawns:GetChildren())
  74.  
  75. for i, char in pairs(contestants) do
  76. if char.Character then
  77. char.Character.HumanoidRootPart.CFrame = spawns.CFrame + Vector3.new(0,10,0)
  78. end
  79. end
  80.  
  81. for i = 10,0,-1 do
  82. status.Value = "The tagger will spawn in ("..i..")"
  83. wait(1)
  84. end
  85.  
  86. chosenTagger.HumanoidRootPart.CFrame = map.TaggerSpawn.CFrame + Vector3.new(0,10,0)
  87. status.Value = "The tagger as spawned!!"
  88. local newHitbox = hitbox:Clone()
  89. newHitbox.Parent = workspace
  90. newHitbox.CFrame = chosenTagger.HumanoidRootPart.CFrame
  91.  
  92. local weld = Instance.new("WeldConstraint",hitbox)
  93. weld.Part0 = hitbox
  94. weld.Part1 = chosenTagger.HumanoidRootPart
  95.  
  96. end
Advertisement
Add Comment
Please, Sign In to add comment