Hi, I’m trying to make a gamemode voting gui, however, when the player clicks on the button to vote, it doesn’t update the tally for other players.
I’ve looked at my script over and over again, but can’t seem to spot any errors.
Note: The gui doesn’t update the tally for the other player until the other player has voted as well.
local KTButton = script.Parent.KillTally.Vote
local KOTHButton = script.Parent.KOTH.Vote
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local placeVote = ReplicatedStorage:WaitForChild("PlaceVote")
local enterVote = ReplicatedStorage:WaitForChild("UpdateVote")
local function updateVote(mode)
local chosenGamemode = script.Parent:FindFirstChild(mode)
local numOfVotes = tonumber(chosenGamemode.CurrentVoteAmount.Text)
local newNumOfVotes = numOfVotes + 1
if numOfVotes == 0 then
for i, v in pairs(game.Players:GetPlayers()) do
wait()
v:WaitForChild("PlayerGui").GamemodeVotingGui.Frame:FindFirstChild(mode).CurrentVoteAmount.Text = tostring(newNumOfVotes)
end
else
for i, v in pairs(game.Players:GetPlayers()) do
wait()
v:WaitForChild("PlayerGui").GamemodeVotingGui.Frame:FindFirstChild(mode).CurrentVoteAmount.Text = tostring(newNumOfVotes)
end
end
end
Any help is appreciated, thanks.