Hello devs.
I am currently making a camping inspired game and I made a dialogue gui for my game.
So I have a problem when I play the game in roblox studio it works but when I run it in roblox it’s not working.
Here is a screeshot and the script.
function ChooseRandomPlayer()
return game.Players:GetChildren()[math.random(1, #game.Players:GetChildren())]
end
when you are by yourself testing because there is only 1 player and you can’t choose a random out of 1 as far as I know. That’s why it’s saying the interval is empty.
Technically math.random(1, 1) is fine. But the second argument was smaller than the first (1, 0) hence the exception. You can’t generate a minimum number of 1 but a maximum of 0.