What I need is a way to make a script that will check the amount of players in the server, do a countdown and execute another script that teleports 2 random players that are in the game to 2 destinations (222.598, 73.536, -925.25 and 222.598, 73.536, -876.25) and after the two players are teleported, they receive swords and duel.
I have tried numerous amounts of code from many different sources, but every single one of them has failed. I do have a little bit in knowledge of Lua, but I've just now learned that knowledge.
This is one of the codes that I have tried.
players = game.Players:GetChildren() players[math.random(1, #players)]:MoveTo(Vector3.new(222.598, 73.536, -876.25) players[math.random(1, #players:MoveTo(Vector3.new(222.598, 73.536, -925.25)
Try this:
Plr1=nil Plr2=nil repeat wait() until game.Players.NumPlayers>=2 --Makes sure that there is at least 2 players in the game. Players=game.Players:GetChildren() Plr1=Players[math.random(1, #Players)] --Sets Plr1 while Plr1==Plr2 do --Repeats until Plr1 is different than Plr2 Players=game.Players:GetChildren() Plr2=Players[math.random(1, #Players)] --Sets Plr2 end Plr1.Character.HumanoidRootPart.CFrame=CFrame.new(Vector3.new(222.598, 73.536, -876.25)) Plr2.Character.HumanoidRootPart.CFrame=CFrame.new(Vector3.new(222.598, 73.536, -925.25))
Anyways, this should work now. If you have any questions or problems, please leave a comment below. Hope I helped :P