Introduction
I have seen lots of guides and help topics on Roblox recreation games. But none for map voting! So today thats exactly what I’m going to teach you to do today!
Usually in Roblox games, there is 3 random maps chosen, then of those the one with the most votes is the one chosen.
Step 1: Creating the Randomizer
I’ve made a guide on this, because I was figuring out how to do this, and is very generic, so here is the guide. The guide provides an explanation.
But today, we are using the slightly modified blocks.
Use a trigger for the blocks.
Thanks to @Kosm0-o, for helping me realize that
and
is not suitable to this and or
is. Make sure the max random number is the same number of maps you have.
Make a lifecycle that transmits when the game starts, and is the same channel you are using for the randomizer to redo the trigger is the same channel that is transmitted on game start. [1]
Follow the guide step by step, and add the lifecycle, and you have created the randomizer!
Why does this work?
The variable “random” is set to a random integer from 1 to 6. The var “1” is spun to that variable. It re-spins the random integer, then sets that to var “2.” The same is done for var “3”.
After that, it performs an if
function.
With the or
check, it checks if 1=2, or 1=3, or 2=3
If it is, then it transmits on “redoTrigger,” which is the channel it starts on, making this a loop, until these conditions are not met.
Otherwise (else), it transmits on the channels. (“1room” + var “1”, “2room” + var “2”, “3room” + var “3”)
Step 2: Creating Text and Voting Buttons
This one is real messy, so try to keep it organized.
Make a text, or google doc, saying each map, and have a number special to it [2], like this:
Set down 3 buttons.
Each button is disabled on game start, has a player active scope, and is invisible on game start.
When the buttons are pressed, transmit on “x,” and it deactivates on “x.”
Make the activation channels (different for each button):
- 1room1
- 2room1
- 3room1
Notice: The last number is the map id.
Also, group them like this when you are done:
The numbers on the left, are the last number in the channel aka the map id.
The numbers on the bottom, are the numbers that tell you which map option it is.
Do the exact same thing with the text.
Why does this work?
The buttons have a global activation scope, which means it activates upon everyone.
It is also invisible on game start, which means you can’t see the button. Also the “x” channels are there to prevent voting again.
Each button activates on a channel, (“1room” + var “1” (from the previous section), “2room” + var “2”, and “3room” + var “3”)
The last number is the map id.
It is the same with the texts, it activates on those same channels, and is not visible on game start.
Step 3: Voting
Get some counters (1 for each map)
Properties (named the map id)
Wire the 1st row, to the 1st counter.
Button Pressed --> Increment Counter
That counter updates the property, “1.”
Do the same with the 2nd row, and 3rd row, and so on, so on.
(I used wire repeaters for organization, that is optional.)
What is happening?
All the buttons with the same map id increment a counter (when pressed). The counter is specific though, it has to be updating the same property as the last number in the activation channel (the map id)
This step is pretty straight-forward, but it gets messy with wires.
Step 5: Ending the Voting
How to make a button host-only (0/10 or )
Follow this guide, on behalf of @NoNoWahoo.
Make the button, so the host can end the voting.
Make an all players relay.
Wire it: Button Pressed --> Run Relay
Make the relay transmit on “x.”
Wire the button to a trigger.
Open blocks, and put this inside, on behalf of @Blackhole927:
Just change the properties to the properties used.
Why does this work?
When the button is pressed, the trigger is triggered. When it is triggered, blocks are run.
It sets the greatest value to -999999. Then it sets the channel name to “1”. Then it checks if the 1st property is greater than the var “greatest”. If so, greatest is set to the current property value, and the channel name is changed to “1”
It does the same with the all the properties. Make sure: NO ELSE/ELSE IF BLOCKS.
At the very end, it broadcasts a message on var “channelname”
Step 6: Teleportal to maps
This step, is fairly simple.
Get a relay that is all players, that runs on a map id (one for each map).
Then get a teleportal:
Make sure the teleportal and relay correspond to the right map.
Why does this work?
When the block code above is run, it broadcasts a message on a channel. [3] Then a relay is run on all players when receiving on one of those channels. Then when it is, it teleports all players to that teleportal. Make sure the map and the relay channel are the SAME ID. (how much times do I have to say “map id” lol)
- 0/10
- 1/10
- 2/10
- 3/10
- 4/10
- 5/10
- 6/10
- 7/10
- 8/10
- 9/10
- 10/10
- 11/10
https://vimeo.com/1022699561?share=copy
Anyways, that’s it, hope you likes this! No seriously though, a is appreciated! :D