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

How to Ensure that the 2nd String of this value doesn't get the First one?

ok so I need to make it that the 2nd string of the value doesn't get the same as the first one

local Rand = Random.new(tick())
local Elements = {"Earth", "Fire", "Lightning", "Water"}

Element.Value = Elements[Rand:NextInteger(1, #Elements)] .. " / " .. Elements[Rand:NextInteger(1, #Elements)]

i need to make it not to pick the same EX: Fire / Fire

1 answer

✓ Accepted answer
local Elements = {"Earth", "Fire", "Lightning", "Water"}

local Random = Random.new(tick())

local FirstElement = Elements[Random:NextInteger(1,#Elements)]
local SecondElement;
repeat wait()
    SecondElement = Elements[Random:NextInteger(1,#Elements)]
until SecondElement ~= FirstElement

Elements.Value = FirstElement.." / "..SecondElement

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