So I want to create a game which will be used as a way for people to vote on something, something interesting I wanted to do with my community that goes beyond using a simple google form.
I imagine it as a game where players will join and will be presented with two or more choices, the player votes and the game owner can look at the polling results at any time
How would I go about this? Do I use httpservice or is there a way I can get away with it only using data storage.
I’m not too concerned about security as this would be used for really minor reason for voting, however I do want to make it so every unique player only has one vote.
Not sure where to begin with this one, but providing resources which might help me would be great. Thank you.
I don’t see the need for using https service. You could have a GUI pop up on the owner’s screen and prompt them for 1 question and 2 answers which would then use a remote event and be sent off to the server. Maybe you could also have a cooldown or timer of 30 seconds to allow a voting process without it being interrupted
On the server, I would have it receive the data and then split the question and answers up into 3 values:
Part 1,
Part 2,
Question.
Then you’d have to detect when the part is touched and when the touch ends which can all be found on the Developer Hub (https://developer.roblox.com)
Right, that’s good to hear, I thought something like this needed to be stored externally elsewhere.
By the way, even if there is a delay on the voting, what if there are several servers constantly updating the poll? What’s a good way to keep things organized?
Polls won’t cross over as long as you don’t use https service or any other service that roblox provides to send data between servers, I don’t see why you should be worried about them clashing. If a poll goes over the exceeded time then personally I would put them into a spectator box until the host chooses a new poll.I would also use as little scripts as possible and add prints to ensure that there are no failures and if it does fail you are able to easily pinpoint what is causing the issue.
Local Script: Prompt with Question and 2 Choices, sends them to the server via a local script
Script: Receives the prompt and sets the question and 2 responses onto parts.
Scripts in the parts: Detect when a part is touched, adds 1 to the value and removes 1 when the touch ends.
After 30 seconds or however long you want, have it end print the results and place all of the players back into a spectating box until there is another poll
If you want a simple poll, where you can view the answers anytime, use OrderedDataStores. I haven’t done this before, but you should be able to create 2 entries in the datastore, with one titled “Yes” with a value of 0, and another with “No” and a value of 0. Then, when a player votes, you can tell the server to use IncrementAsync on the corresponding key. To view the data, simply get the value of “Yes” and “No” using GetAsync, and display it.