I am making a game called Agent Blox which is based on Juggernaut but how to I make a script that chooses a random player to be in another team (classname) I think there is a way I could fix that but I don't know how to refer to a player in a script! game.Players.Player does not work. Please help!
In the example I have done for you below, I start off with picking a variable for the TeamColor. Then I choose a random player by using math.random() with the minimum amount of players (1) to the number of players, which I can find by using "#game:GetService("Players"):GetPlayers()", or I could have done "game:GetService("Players").NumPlayers". Both work fine. Then I make that players TeamColor the BrickColor of the variable we provided earlier.
local TeamColor = "Really red" local RandPlayer = game:GetService("Players"):GetPlayers()[1, #game:GetService("Players"):GetPlayers()] RandPlayer.TeamColor = BrickColor.new(TeamColor)
local players = game.Players:GetChildren() local log10 = math.random(1, #players) players[log10].TeamColor = "Bright blue" -- Make Juggeranut team Bright blue players[log10].Character:MoveTo(Vector3.new(0,0,0)) -- change 0,0,0 To a position the juggernaut will spawn.
PM
Hybric if script
doesn't work
This might not work but here you go.
game.Workspace.Players.Random = Random.Players
Probably try that in the script