Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rStorage = game:GetService("ReplicatedStorage")
- local rEvents = rStorage:WaitForChild("RemoteEvents")
- local configs = rStorage:WaitForChild("Configs")
- local maps = rStorage:WaitForChild("Maps")
- rEvents.AddPlayer.OnServerEvent:Connect(function(plr)
- rEvents.AddPlayer:FireAllClients(plr)
- end)
- rEvents.RemovePlayer.OnServerEvent:Connect(function(plr)
- rEvents.RemovePlayer:FireAllClients(plr)
- end)
- rEvents.AddVote.OnServerEvent:Connect(function(plr,name)
- local map = rStorage.Votes:FindFirstChild(name)
- if map then
- map.Value = map.Value + 1
- end
- end)
- rEvents.RemoveVote.OnServerEvent:Connect(function(plr,name)
- local map = rStorage.Votes:FindFirstChild(name)
- if map then
- map.Value = map.Value - 1
- end
- end)
- while true do
- local timer = 15
- repeat wait()
- configs.Status.Value = "Intermission: ".. timer
- wait(1)
- timer = timer - 1
- until timer == 0
- configs.Status.Value = "..."
- wait(1)
- for i,v in pairs(maps:GetChildren()) do
- local voteId = v:FindFirstChild("VoteId")
- if voteId then
- local intValue = Instance.new("IntValue",rStorage.Votes)
- intValue.Name = v.Name
- intValue.Value = 0
- rEvents.CreateVote:FireAllClients(v.Name,voteId.Value)
- end
- end
- timer = 10
- repeat wait()
- configs.Status.Value = "Map vote: ".. timer
- wait(1)
- timer = timer - 1
- until timer == 0
- configs.Status.Value = "..."
- local map
- local highest = 0
- for i,v in pairs(rStorage.Votes:GetChildren()) do
- if v:IsA("IntValue") then
- local curMap = maps:FindFirstChild(v.Name)
- if v.Value > highest and curMap then
- map = curMap
- end
- end
- end
- if map then
- configs.Status.Value = map.Name
- else
- map = maps:GetChildren()[1]
- configs.Status.Value = map.Name
- end
- rEvents.RemoveAllVotes:FireAllClients()
- for i,v in pairs(rStorage.Votes:GetChildren()) do
- v:Destroy()
- end
- wait(3)
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement