Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can anyone see the error?

I have some code and the until F1 ~= F2 has red under it, Whats wrong?

local list = game.Players:GetPlayers()
			F1 = list[math.random(#list)]
			F2 = list[math.random(#list)]
			repeat if F1 ==F2 then
				F2 = list[math.random(#list)] 
			until F1 ~= F

2` Thats the code, Thanks for the help in advance.

1 comment

0

Please post the output.

3 answers

To start off, You have a typo on line 6.

until F1 ~= F

It should be

until F1 ~= F2

Also, you have the If statement in the wrong spot. It should be before the repeat:

local list = game.Players:GetPlayers()
            F1 = list[math.random(#list)]
            F2 = list[math.random(#list)]
            if F1 ==F2 then
                repeat
                F2 = list[math.random(#list)] 
                until F1 ~= F2

Lastly, You forgot to end your if statement.

local list = game.Players:GetPlayers()
            F1 = list[math.random(#list)]
            F2 = list[math.random(#list)]
            if F1 ==F2 then
                repeat
                F2 = list[math.random(#list)] 
                until F1 ~= F2
            end

try

repeat F2 = list[math.random(1,#list)] until F1 ~= F2
--Btw im pretty sure your error is because you dont have math.random(1,#list)

What does it say when you hover your mouse over it?

Really? two thumbs down? Tough community. I was going to answer it once he explained that .-.

1 comment

0

it said end expected so I added an end and it worked, Thanks for the tip

This discussion is preserved as it was. New answers, comments, and votes are closed.