Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --you will need to hook this up to the rounds script so that all the runners get the players on runners
- --you don't have to create a table for each runner because they won't do it to themselves.
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Characters = ReplicatedStorage:FindFirstChild("Characters") or Instance.new("Folder",ReplicatedStorage)
- Characters.Name = "Characters"
- local CharacterPositionRemote = ReplicatedStorage:FindFirstChild("CharacterPosition") or Instance.new("RemoteEvent",ReplicatedStorage)
- CharacterPositionRemote.Name = "CharacterPosition"
- local CharacterConnections = {}
- local Positions = {}
- Players.PlayerAdded:connect(function(player)
- CharacterConnections[player.Name] = player.CharacterAdded:connect(function()
- wait(4)
- local myplayers = {}
- for k,_ in pairs (Positions) do
- table.insert(myplayers,k)
- end
- CharacterPositionRemote:FireAllClients({["Destroy these characters"]=myplayers})
- end)
- end)
- Players.PlayerRemoving:connect(function(player)
- if CharacterConnections[player] then
- CharacterConnections[player]:disconnect()
- CharacterConnections[player] = nil
- end
- if Players[player.Name]then
- Positions[player.Name]=nil
- end
- end)
- CharacterPositionRemote.OnServerEvent:connect(function(player,data)
- Positions[player.Name]=data
- end)
- while true do
- wait()
- CharacterPositionRemote:FireAllClients(Positions)
- end
Add Comment
Please, Sign In to add comment