I'm making a murder mystery type game.There's a virus, the doctor, and finally the other civilians, but my script keeps saying in the output, "no players." Even though I'm fully inside of the game ready to play. Here's the script:
local killWeapon = game.ServerStorage.Claws
local Players = game.Players
local player = Players:GetChildren()
wait(5)
if #player == 0 then
print("No players.")
return
end
if#player >= 1 then
local pickedPl = player[math.random(1, #player)]
pickedPl.StarterGui.Role.Frame.Visible = true
pickedPl.StarterGui.Role.Frame.Roletell.Text = "Murderer"
pickedPl.StarterGui.Role.Frame.Roletell.TextColor3 = Color3.new(255, 0, 0)
killWeapon.Parent = pickedPl.Backpack
local pickedP2 = player[math.random(1, #player)]
if player ~= pickedPl then
if player == pickedP2 then
pickedP2.StarterGui.Role.Frame.Visible = true
pickedP2.StarterGui.Role.Frame.Roletell.Text = "Scientist"
pickedP2.StarterGui.Role.Frame.Roletell.TextColor3 = Color3.new(0, 0, 255)
end
end
if player ~= pickedPl or pickedP2 then
pickedP2.StarterGui.Role.Frame.Visible = true
pickedP2.StarterGui.Role.Frame.Roletell.Text = "Survivor"
pickedP2.StarterGui.Role.Frame.Roletell.TextColor3 = Color3.new(0, 255, 0)
end
end

2 comments
Use Players:GetPlayers()
Didn't help. Output still responded with No players.