Gamemode Voting Not Updating

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.

if this is written in a “LocalScript” it wont update for other players it needs to be in a normal “script” ( a server script)

3 Likes

Exactly

But make a remote event or function as server scripts don’t work in client environment. You’d need a client and server script.

Have you checked that the Gui is on the server? Sometimes if Gui is in startergui it won’t be replicated to the server.

Gui won’t work on the server, he can use RemoteEvent:FireAllClients()

Ayo, thanks for everything guys!