Z_Dev

test

Dec 26th, 2021
1,212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. -- variables
  2.  
  3. local replicatedStorage = game:GetService("ReplicatedStorage")
  4. local serverStorage = game:GetService("ServerStorage")
  5.  
  6.  
  7. local players = game.Players:GetPlayers()
  8.  
  9. local worthessJunk = serverStorage:WaitForChild("WorthlessJunk")
  10. local values = replicatedStorage:WaitForChild("Values")
  11. local maps = serverStorage:WaitForChild("Maps"):GetChildren()
  12.  
  13. local Status = values:WaitForChild("Status")
  14.  
  15. local Knife = worthessJunk.Knife
  16. local Revolver = worthessJunk.Revolver
  17.  
  18. local spawnOffset = 5
  19.  
  20. -- I hate tables and all developers should be amused by it
  21. local contestants = {}
  22.  
  23. local playersToStart = 1
  24.  
  25. -- check
  26.  
  27. local outcome
  28.  
  29. -- functions
  30.  
  31. local function chooseRandomMap()
  32.     local randomMap = maps[math.random(1, #maps)]
  33.     print("the function chose "..randomMap.Name)
  34.     return randomMap
  35. end
  36.  
  37. local function teleportPlayers(avaibleSpawns, avaiblePlayers)
  38.    
  39.     -- loop through all the players in a table
  40.     print("got to the first part")
  41.     for _, plr in pairs(avaiblePlayers) do
  42.         print("got to the second part")
  43.         if plr.Character then
  44.             print(plr.Name)
  45.             print("got to the third part")
  46.             plr.Character.PrimaryPart.CFrame = avaibleSpawns.CFrame + Vector3.new(0, spawnOffset, 0)
  47.             print("got to the last part")
  48.         end
  49.     end
  50. end
  51.  
  52. local function chooseMurderer(avaiblePlayers)
  53.    
  54.    
  55.    
  56. end
  57.  
  58. local function sheriff(avaiblePlayers)
  59.    
  60. end
  61.  
  62. local function kickOutPlayer()
  63.     -- blah blah blah table.remove
  64. end
  65.  
  66. while wait(1) do
  67.     repeat
  68.         wait()
  69.         Status.Value = "You need "..playersToStart.." players to start"
  70.     until #players < playersToStart  -- check if there's enough players
  71.    
  72.     wait(0.3)
  73.    
  74.     Status.Value = "Choosing map.."
  75.     wait(4)
  76.    
  77.     local chosenMap = chooseRandomMap():Clone()
  78.     chosenMap.Parent = game.Workspace
  79.     Status.Value = "The chosen map is "..chosenMap.Name
  80.    
  81.     for i, v in pairs(game.Players:GetPlayers())do
  82.         if v then
  83.             table.insert(contestants, v)
  84.            
  85.         end
  86.     end
  87.    
  88.     wait(3)
  89.    
  90.     Status.Value = "Teleporting Players"
  91.    
  92.     local SpawnPoints = chosenMap.SpawnPoints:GetChildren()
  93.    
  94.     local randomSpawnPoint = SpawnPoints[math.random(1, #SpawnPoints)]
  95.    
  96.     wait(3)
  97.    
  98.     teleportPlayers(randomSpawnPoint, contestants)
  99.     wait(2)
  100.    
  101. end
Advertisement
Add Comment
Please, Sign In to add comment