i am making a random player chooser, a chosen player will get their name printed on the output, however, it prints out the number "1" out of a table instead of their name. the script is:
players = {} local function onCharacterAdded(chr) table.insert(players, chr) local value = math.random(1,#players) print(value) end game.Players.PlayerAdded:Connect(onCharacterAdded)
i was going to give the chosen player a tool, however i don't know if it will work if its going to print out numbers.
If you want to select random players name from a table do this:
players = {} local function onCharacterAdded(chr) table.insert(players, chr) local value = players[math.random(1,#players)] print(value) end game.Players.PlayerAdded:Connect(onCharacterAdded)
PS: You almost got it! Hoped it helps :D