I just want it to pick 1 person. I noted where I think the problem starts.
function chooseChosen()
local gplrs = {}
coroutine.resume(coroutine.create(function()
local plrs = game.Players:GetChildren()
for i = 1,#plrs do
if CheckPlayers() then
if 1 == 1 then
print("There are ".. i.. " amount of players".." Game is starting")
table.insert(gplrs,plrs[i])
local ran = math.random(1,#gplrs) -- Where I think the problem starts
if gplrs[ran] ~= nil and gplrs[ran].Character ~= nil then
local pran = gplrs[ran]
for x = 1,1 do
print(pran.Name)
local Role = Instance.new("StringValue")
Role.Name = "Role"
Role.Value = "Chosen"
Role.Parent = pran.Character
if pran.Character:FindFirstChild("Role") then
for c,v in pairs(pran.Character:GetChildren()) do
if v.ClassName == "Part" then
v.Transparency = v.Transparency + 1
end
end
end
end
end
end
end
end
end))
end

1 comment
Thank you so much!