Hi there! In this tutorial, I will teach you how to make a random player chooser! To start off, we are going to make a variable as so:
local plrs = game.Players
Lets make another variable. This will choose a player.
local num = math.random(1, #plrs:GetChildren())
Now, we can choose our player by using the two variables.
local chosenplr = plrs:GetChildren()[num]
Now you can script what will happen to the chosen player. Heres an example.
local plrs = game.Players local num = math.random(1, #plrs:GetChildren()) local chosenplr = plrs:GetChildren()[num] print(chosenplr.Name.." was chosen!")
The output when playing the game with this script will be like this:
(player's name) was chosen!
Thats all. Thanks for viewing this tutorial!