Show map votes to whole server rather than client

Basically, gets all the selections, when player picks one, sends remote to server as that being their vote, creates a lil player icon so they know what they voted on. However, you can’t see what other players have voted on. How can I get it to show the whole servers votes over just the clients?

for _, v in pairs(Choices:GetChildren()) do
	v.Activated:Connect(function()
		if not CanVote then return end
		
		if PlayersVote then
			local Vote = PlayersVote.Votes:FindFirstChild(Player.Name)
			if Vote then
				Vote:Destroy()
				PlayersVote = nil
			end
		end
		
		PlayersVote = v
		
		ChooseMap:FireServer(v.Map.Text)
		
		local PlayerIcon = Instance.new('ImageLabel')
		PlayerIcon.AnchorPoint = Vector2.new(0.5, 0.5)
		PlayerIcon.BackgroundTransparency = 1
		PlayerIcon.Name = Player.Name
		PlayerIcon.Position = GetRandomPosition()
		PlayerIcon.Size = UDim2.new(0.25, 0, 0.25, 0)
		PlayerIcon.SizeConstraint = Enum.SizeConstraint.RelativeYY
		PlayerIcon.Image = Players:GetUserThumbnailAsync(Player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
		
		PlayerIcon.ScaleType = Enum.ScaleType.Fit
		
		PlayerIcon.Parent = v.Votes
	end)
end

So if I’m understanding you right: you want a way for clients to see what other people have voted? So if I voted X, and you voted Y, you would want to know what I voted?

You could use a RemoteFunction to request to view the votes of other players from the server.

How could I do that efficiently tho? I don’t wanna just loop every second to check

I would instead use the RemoteEvent.OnClientEvent event. Then, you can just add a RemoteEvent:FireAllClients(args) each time someone votes so that you constantly have the most updated information from the server.

1 Like