I am trying to code a role picker. Can anybody help?
So basically, I am trying to code a role picker. There is one person chosen to be a werewolf, one person chosen to be a villager, one person chosen to be a clairvoyant, one person chosen to be a witch, one person chosen to be a jester and one person chosen to be a clown. I also want to make it so that there is only one person per role, no one can have the same role as the other. Everything in this script works except for the role picker (at the bottom of the script). Can anybody help me? Here is the whole script that I have made:
002 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
004 | local ServerStorage = game:GetService( "ServerStorage" ) |
006 | local Status = game.ReplicatedStorage.Status |
010 | Status.Value = "Waiting for enough players to play" |
011 | repeat wait( 1 ) until game.Players.NumPlayers > = 2 |
012 | Status.Value = "Intermission" |
014 | Status.Value = "Get ready!" |
019 | for i, player in pairs (game.Players:GetPlayers()) do |
021 | table.insert(plrs,player) |
025 | local GameZone = game.Workspace.GameZone |
027 | local ClonedGameZone = GameZone:Clone() |
028 | ClonedGameZone.Parent = workspace |
031 | local Seats = ClonedGameZone:FindFirstChild( "Seats" ) |
033 | print ( "Seats not found" ) |
036 | local AvailableSeats = Seats:GetChildren() |
037 | for i, player in pairs (plrs) do |
039 | character = player.Character |
044 | character:FindFirstChild( "HumanoidRootPart" ).CFrame = AvailableSeats [ 1 ] .CFrame + Vector 3. new( 0 , 10 , 0 ) |
045 | table.remove(AvailableSeats, 1 ) |
047 | character.Humanoid.WalkSpeed = 0 |
048 | character.Humanoid.JumpPower = 0 |
050 | local GameTag = Instance.new( "BoolValue" ) |
051 | GameTag.Name = "GameTag" |
052 | GameTag.Parent = player.Character |
063 | Status.Value = "Choosing roles.." |
070 | local WerewolfNumber = math.random( 1 , #plrs) |
071 | local Werewolf = #plrs [ WerewolfNumber ] |
072 | table.remove(plrs,WerewolfNumber) |
073 | WerewolfNumber.PlayerGui.MainFrame.Visible = true |
074 | WerewolfNumber.PlayerGui.MainFrame.Role.Text = "A WEREWOLF" |
075 | WerewolfNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 203 , 0 , 4 ) |
076 | WerewolfNumber.PlayerGui.MainFrame.Description.Text = "You are an enemy. You can kill anyone except your teammate: the Clown. Blend in with the allies to not look suspicious, try not to get voted out and win by killing all allies until there is one left. Good luck." |
077 | table.insert(Enemies,WerewolfNumber) |
079 | local ClownNumber = math.random( 1 , #plrs) |
080 | local Clown = #plrs [ ClownNumber ] |
081 | table.remove(plrs,ClownNumber) |
082 | ClownNumber.PlayerGui.MainFrame.Visible = true |
083 | ClownNumber.PlayerGui.MainFrame.Role.Text = "A CLOWN" |
084 | ClownNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 253 , 102 , 8 ) |
085 | ClownNumber.PlayerGui.MainFrame.Description.Text = "You are an enemy. Only once in the whole game, you can kill anyone, except for your teammate: the Werewolf, when it's their turn to play. Blend in with the allies to not look suspicious, try not to get voted out and win by killing all allies until there is one left. Good luck." |
086 | table.insert(Enemies,ClownNumber) |
088 | local VillagerNumber = math.random( 1 , #plrs) |
089 | local Villager = #plrs [ VillagerNumber ] |
090 | table.remove(plrs,VillagerNumber) |
091 | VillagerNumber.PlayerGui.MainFrame.Visible = true |
092 | VillagerNumber.PlayerGui.MainFrame.Role.Text = "A VILLAGER" |
093 | VillagerNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 206 , 205 , 134 ) |
094 | VillagerNumber.PlayerGui.MainFrame.Description.Text = "You are an ally. You do not have a turn to play during the night so you cannot do anything. However, your goal is to try to vote out the enemies (the Werewolf and the Clown). Good luck." |
095 | table.insert(Allies,VillagerNumber) |
097 | local JesterNumber = math.random( 1 , #plrs) |
098 | local Jester = #plrs [ JesterNumber ] |
099 | table.remove(plrs,JesterNumber) |
100 | JesterNumber.PlayerGui.MainFrame.Visible = true |
101 | JesterNumber.PlayerGui.MainFrame.Role.Text = "A JESTER" |
102 | JesterNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 4 , 61 , 206 ) |
103 | JesterNumber.PlayerGui.MainFrame.Description.Text = "You are neutral. Your goal is to get voted out. However, you don't win when you get killed. Act suspicious and blend in with the enemies. Good luck." |
104 | table.insert(Neutrals,JesterNumber) |
106 | local WitchNumber = math.random( 1 , #plrs) |
107 | local Witch = #plrs [ WitchNumber ] |
108 | table.remove(plrs,WitchNumber) |
109 | WitchNumber.PlayerGui.MainFrame.Visible = true |
110 | WitchNumber.PlayerGui.MainFrame.Role.Text = "A WITCH" |
111 | WitchNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 80 , 0 , 206 ) |
112 | WitchNumber.PlayerGui.MainFrame.Description.Text = "You are an ally. After the werewolves have killed someone, you can either revive the victim with your reviving potion that you can use only once in the entire game, kill someone other than the victim with your killing potion that you can use only once in the entire game, or not do anything. Try to vote out the enemies. Good luck." |
113 | table.insert(Allies,WitchNumber) |
115 | local ClairvoyantNumber = math.random( 1 , #plrs) |
116 | local Clairvoyant = #plrs [ ClairvoyantNumber ] |
117 | table.remove(plrs,ClairvoyantNumber) |
118 | ClairvoyantNumber.PlayerGui.MainFrame.Visible = true |
119 | ClairvoyantNumber.PlayerGui.MainFrame.Role.Text = "A CLAIRVOYANT" |
120 | ClairvoyantNumber.PlayerGui.MainFrame.Role.TextColor 3 = Color 3. fromRGB( 252 , 0 , 215 ) |
121 | ClairvoyantNumber.PlayerGui.MainFrame.Description.Text = "You are an ally. When it's your turn to play during the night, you can choose someone to see their role, so choose wisely. Try to vote out the enemies. Good luck." |
122 | table.insert(Allies,ClairvoyantNumber) |