Alright, to begin this with, I’m trying to make somewhat of a “Murder Mystery 2” but with my version. I found this very cool tutorial from youtube by HowToRoblox
The thing that I want to achieve was located at the end of the video. Well here’s my problem.
local roles =
{
Murder = {1, Color3.fromRGB(221, 29, 29), script.Knife};
Sheriff = {1, Color3.fromRGB(22, 120, 240), script.Gun};
Civilian = {100, Color3.fromRGB(62, 197, 32)}
}
local rolesTable = {"Murder", "Sheriff", "Civilian"}
function handleGui(plr, pickedRole, weapon)
for i, player in pairs(game.Players:GetPlayers()) do
local gui = player.PlayerGui.Picker
gui.Enabled = true
for x = 1, 10 do
local randomRole = rolesTable[math.random(1, #rolesTable)]
gui.Background.RoleGiven.TextColor3 = roles[randomRole][2]
gui.Background.RoleGiven.Text = randomRole
wait(0.2)
end
gui.Background.RoleGiven.TextColor3 = roles[pickedRole][2]
gui.Background.RoleGiven.Text = pickedRole
if weapon then
weapon:Clone().Parent = player.Backpack
end
wait(2)
gui.Enabled = false
end
end
So, everytime my pre-installed intermission system was done, it was meant to run this random picker script. But the problem is, it says that in the line
gui.Background.RoleGiven.TextColor3 = roles[pickedRole][2]
gui.Background.RoleGiven.Text = pickedRole
Attempt to index nil with number.
I tried to solve it myself but I can’t. Please do help me if possible, thanks.