I have a button that enters a players vote and only want them to vote once, I'm tried using datastores but to no avail. Any help is appreciated.
✓ ANSWER ACCEPTED
How can I check if a player has clicked a click detector before?
1 answer
✓ Accepted answer
It's better to use a table for this:
local playersWhoVoted = {}
ClickDetector.MouseClick:Connect(function(playerWhoClicked)
if not playersWhoVoted[playerWhoClicked] then
playersWhoVoted[playerWhoClicked] = true
else
return
end
end)
I'm not sure what you want to do exactly, maybe you want players to only vote for one map and then you also want to tally the votes. I'm not going to answer how to do those because they're beyond the scope of the question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Thank you so much!
Make sure to accept my answer if it works.
Just one question, how would i append something to that table(playerwhovoted)
Doing table[key] = value creates an element in the table with key and value. Line 5 creates an entry to playersWhoVoted with the playerWhoClicked being the heading and 'true' being the value of that heading.
Ok! thanks, also there is no accept answer button?
It should at the bottom of my answer, right next to the report button.
i think its because of my browser, let me change it rq