niu
niu

Reputation: 11

Roblox Studio 1v1 arena spawning

I'm making a 1v1 arena game, but I'm having some issues with spawning players in arenas. I want it so when they click on a button on the menu called "Play Random", it will wait until another player clicks it too, and if so, teleports them both to one arena; one player on 1 spawn point and the second player on the second spawn point. When they finish, they should both be teleported to the menu again so others can play at this arena (I've made 3 arenas).

function Click(mouse)
game.Players.LocalPlayer.TeamColor = BrickColor.new("Black")
wait(5)
for i, v in pairs(game.Teams["Waiting"]:GetPlayers())do
    local randomPlayer = game.Teams["Waiting"]:GetPlayers()
    [math.random(1,#game.Teams["Waiting"]:GetPlayers())]
    randomPlayer.TeamColor = BrickColor.new("Lime green") or BrickColor.new("Toothpaste")
end
end


script.Parent.MouseButton1Down:connect(Click)

This is the script for the Play Random button:

Teams

Main Menu

Upvotes: 1

Views: 734

Answers (1)

user20242396
user20242396

Reputation: 1

first, put the script into starterpack folder, then open the script (the 1v1 script) and click on your keyboard ALT F4 at the same time, then it will force the script to start at that very moment and should work. Good Luck!

Upvotes: 0

Related Questions