This simple script I made selects two players from the Players folder and just sends them to a battle script in a module script. But, how can I make it so that the players selected are always random instead of just the first two? This is my script so far.
while wait(10) do
getPlayers = game.Players:GetChildren()
local m = require(game.Workspace.Events) --Getting the Module Script
p1 = getPlayers[1] --HOW CAN I MAKE IT SO THAT THE PLAYERS SELECTED ARE RANDOM? (The question I'm trying to ask)
p2 = getPlayers[2]
battle = m.Battle(p1, p2) --Battle will either return 1, 2, or 3 (1 = p1 won, 2 = p2 won, 3 = max time reached)
if battle == 1 then
print(p1.. " has won!")
elseif battle == 2 then
print(p2.. " has won!")
else
print("maximum duel time reached")
end
end
