RN.Value = (math.random(7))
if RN.Value == LRN.Value then
print "Same Number!"
while RN.Value == LRN.Value do
RN.Value = (math.random(7))
end
elseif RN.Value ~= LRN.Value then
print "New Number!"
end
print(RN.Value)
LRN.Value = RN.Value
RN = Room Number LRN = Last Room Number
That script above is made so that the same room number can't be generated twice in a row. If it is, it's supposed to keep generating numbers until it gets a new number, but it doesn't work. It always prints 'New Number!' even when it's the same number as last time. Can someone help me fix this to work properly? Thanks.

2 comments
The code you posted does work as intended. You must have something else that's interfering with the outcome.
Yeah, you're right. I just found out what was interfering with it. It's such a silly mistake it would literally be embarrassing if other people knew what the error was, lol. Thanks though!