Guest User

Untitled

a guest
Apr 1st, 2015
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. --you will need to hook this up to the rounds script so that all the runners get the players on runners
  2. --you don't have to create a table for each runner because they won't do it to themselves.
  3.  
  4. local Players = game:GetService("Players")
  5. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  6. local Characters = ReplicatedStorage:FindFirstChild("Characters") or Instance.new("Folder",ReplicatedStorage)
  7. Characters.Name = "Characters"
  8. local CharacterPositionRemote = ReplicatedStorage:FindFirstChild("CharacterPosition") or Instance.new("RemoteEvent",ReplicatedStorage)
  9. CharacterPositionRemote.Name = "CharacterPosition"
  10.  
  11. local CharacterConnections = {}
  12. local Positions = {}
  13.  
  14. Players.PlayerAdded:connect(function(player)
  15.     CharacterConnections[player.Name] = player.CharacterAdded:connect(function()
  16.         wait(4)
  17.     local myplayers = {}
  18.     for k,_ in pairs (Positions) do
  19.         table.insert(myplayers,k)
  20.     end
  21.     CharacterPositionRemote:FireAllClients({["Destroy these characters"]=myplayers})
  22.     end)
  23. end)
  24.  
  25. Players.PlayerRemoving:connect(function(player)
  26.     if CharacterConnections[player] then
  27.         CharacterConnections[player]:disconnect()
  28.         CharacterConnections[player] = nil
  29.     end
  30.     if Players[player.Name]then
  31.         Positions[player.Name]=nil
  32.     end
  33. end)
  34.  
  35. CharacterPositionRemote.OnServerEvent:connect(function(player,data)
  36.     Positions[player.Name]=data
  37. end)
  38. while true do
  39.     wait()
  40.     CharacterPositionRemote:FireAllClients(Positions)
  41. end
Add Comment
Please, Sign In to add comment