Advertisement
Guest User

Scripting a map Randomizer

a guest
Jun 27th, 2019
2,423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. -- Main script (goes in ServerScriptService)
  2.  
  3. local maps = game.Lighting.Maps:GetChildren() --a variable for the maps
  4.  
  5. while true do -- a loop
  6. wait()
  7. chosenmap = maps[math.random(1,#maps)] -- gets a random map between the three
  8. chosenmap:Clone().Parent = workspace -- sets the parent to workspace
  9. for i,v in pairs(game.Players:GetChildren())do
  10. if v.Character then
  11. v.Character.Torso.CFrame = workspace:FindFirstChild(chosenmap.Name).Spawn.CFrame
  12. wait(3) -- time of the round
  13. workspace:FindFirstChild(chosenmap.Name):Destroy() -- destroys the map after round has ended
  14. end
  15. end
  16. end
  17.  
  18. -- There will be no intermission for this tutorial, part 2 will have one
  19.  
  20. (Make sure your maps are in a folder named 'Maps' and in Lighting,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement