I am testing a script that will execute code whenever a player joins the game, and the code ran will be randomly selected from a table using math.random, however when I played it, there is nothing in the output, and the script appears to fail!
local options = {"op1", "op2"}
function option()
local randomOption = math.random(1,#options)
if randomOption == "op1" then
print("this")
elseif randomOption == "op2" then
print("that")
end
end
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(option)

1 comment
Error:numbers cannot be a string okay? how simple is that