Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rep = game:GetService("ReplicatedStorage")
- local boolean = rep:WaitForChild("Booleans"):WaitForChild("RevealVotes")
- local variables = rep:WaitForChild("Variables")
- local voteChoice1 = variables:FindFirstChild("VoteChoice1")
- local voteChoice2 = variables:FindFirstChild("VoteChoice2")
- local voteChoice3 = variables:FindFirstChild("VoteChoice3")
- local winner = variables:FindFirstChild("Winner")
- boolean:GetPropertyChangedSignal("Value"):Connect(function()
- if boolean.Value == true then
- --release the bees!
- local players = game:GetService("Players"):GetPlayers()
- for x, player in pairs(players) do
- if player.voted then
- player.voted.Value = true
- end
- wait()
- end
- winner.Value = nil
- local mapvotes = {}
- local biggestone
- table.insert(mapvotes,voteChoice1.Value)
- wait()
- table.insert(mapvotes,voteChoice2.Value)
- wait()
- table.insert(mapvotes,voteChoice3.Value)
- table.sort(mapvotes)
- local biggest = tonumber(mapvotes[#mapvotes])
- if biggest == voteChoice1.Value then
- biggestone = variables:FindFirstChild("Choice1")
- end
- if biggest == voteChoice2.Value then
- biggestone = variables:FindFirstChild("Choice2")
- end
- if biggest == voteChoice3.Value then
- biggestone = variables:FindFirstChild("Choice3")
- end
- if biggestone then
- winner.Value = biggestone
- end
- else
- local players = game:GetService("Players"):GetPlayers()
- for x, player in pairs(players) do
- if player.voted then
- player.voted.Value = false
- end
- wait()
- end
- voteChoice1.Value = 0
- voteChoice2.Value = 0
- voteChoice3.Value = 0
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement