Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Roblox Lua | How do i make a random number for EACH player?

Asked by 4 years ago
Edited 4 years ago

So, im trying to make an system to choose an role for each player, and also choose a map for all players, so i tried this:

01local roundLength = 10
02local intermissionLength = 5
03local status = game.ReplicatedStorage.IntermissionStatus
04local inround = game.ReplicatedStorage.InRound
05local chosenRandomNumberValue = game.ReplicatedStorage.chosenNumber
06local displaychosenrole = game.StarterGui.areyoumurdorsherifforinno.Chosen.TextLabel
07local player = game.Players.LocalPlayer
08local chosenRoleValue = game.ReplicatedStorage.TheChosenRole
09 
10local randomMapNumber = math.random(1,3)
11 
12 
13local mineshaft = game.Workspace.MineshaftSpawn
14local milbase = game.Workspace.MilbaseSpawn
15local lobby = game.Workspace.LobbySpawn
View all 80 lines...

And of course, it chooses an map for each player, and every player has the same role.. I tried switching it, and even doing it in another script, also i this is in "ServerScriptService", ofc its a normal script. Also does it need to be a local script, because if it does then how do i do that then, because i cant put a local script in "ServerScriptStorage". Also i want to make it so that only 1 player gets murderer, and only one sheriff, all the others become innocents.

1
You can store the different roles in a table, then let it randomly choose one of the roles u put in the table, and when a certain role is taken you remove it from the table. DeUltimate23 142 — 4y
0
I mean this is just another way to do it, DeUltimate23 142 — 4y
0
why are you settings everyones team color to the same color testing34545 12 — 4y
0
@testing34545 because i have 2 teams, playing and waiting, so that in the chat the murderer isnt red, and so on. VikkiVuk 74 — 4y
0
so how do i make it that only murderer and sheriff get removed, and everyone else becomes innocent? please post this as an answer, also i have no clue how to do the tables.. VikkiVuk 74 — 4y

Answer this question