I have this script that is supposed to collect player votes, sort them and figure out who the 2 people with the most votes were. This script works up until it’s supposed to name off the 2 players, where it just pauses. There is no error in the output screen and I’m not really sure what to do. The variable “vote” in the remote event is a player instance that gets sent from the client. The local script gets the player from game.Players itself.
local readTable = {}
local votes = {}
for _, plr in ipairs(game.Teams.Players:GetPlayers()) do
table.insert(votes, {plr, 0})
end
client.VoteSent.OnServerEvent:Connect(function(player,vote,nickname)
for i, v in ipairs(votes) do
if v[1] == vote then
v[2] += 1
end
end
readTable[player.NameItems.Nickname.Value] = nickname
end)
wait(30)
for _, plr in ipairs(votingPlayers) do
server.RecallAllVotes:FireClient(plr)
end
table.sort(votes, function(a,b)
return a[2] > b[2]
end)
displayText("All votes have been cast. Let's see the results.")
wait(6)
for plr, vote in pairs(readTable) do
displayText(plr .. " has voted for " .. vote .. ".")
wait(4)
end
displayText("The two players who are at risk of elimination are...")
wait(8.5)
--This is where it pauses
displayText(votes[1].NameItems.Nickname.Value .. " and " .. votes[2].NameItems.Nickname.Value .. ".")
votes[1].Team = game.Teams["Elimination Trial"]
votes[2].Team = game.Teams["Elimination Trial"]

2 comments
your script is not working
obviously