How could i make a voting system? any idea?

Hello, i want to know any ideas of how to make a voting system and do players make 1 vote when touch a padding

This is just a simple outline but essentially you would want a script on the server side listening to Touched events for each of the pads. When it detects a touch, figure out which player it was that touched it using some method such as Players:GetPlayerFromCharacter(). You will need some sort or table to track which player has voted for what (assuming you want players to be able to change their vote). I would recommend setting up a table containing all the Players in the game where the key is the Player object and the value is which vote they have submitted. Initially all players votes would be nil. You can then simply update the value at the key after detecting a Player touching a voting pad, something like VoteList[player] = “Name of the option they voted for”. You will need a function that loops through the VoteList and counts how many votes there are for each option. You could call this function after each new vote event, or periodically during the voting period to send updates to the clients on the current progress of voting. Then, at the end of the voting period, use this vote counting loop to figure out the winner of the vote and act accordingly to that result.

2 Likes

Can you show us your code? If you have any.

At the time of reading it is easy but in practice it is too difficult for me to do all this :frowning:

I haven’t started yet…
I only have a button ‘mouse1buttondown’ and it is connected with a remote event to the script, but in the script I don’t know how to do all this

localscript:

script.Parent.MouseButton1Click:Connect(function()

script.Parent.votere:FireServer()

end)

serverscript:

script.Parent.votere.OnServerEvent:Connect(function()
	
end)

I haven’t started yet…
I only have a button ‘mouse1buttondown’ and it is connected with a remote event to the script, but in the script I don’t know how to do all this

Didn’t you say that you were going to have it when you step on a part?

If you did change that to this part.Touched:Connect(function()

I just changed it to be a button, it can be done like that too right?

Well, what are you trying to do?

When I click on the button, how can I add 1 vote from the player?

Make value if they step on the part or click on the button.

Something like this?

script.Parent.votere.OnServerEvent:Connect(function()
	local votenumber = script.Parent.valvote.Value
	
	votenumber += 1
end)

votenumber → it’s a int value