I genuinely cannot figure out why this text randomizer isn't working

local UI = script.Parent

local tableTips = {"This game was just updated for the first time in 2 years!","Join my 
Discord server on this game's page for more info.","This game was one of the first 
games that I ever made","This game has changed alot over the years, There used to be 
an arena but I figured it didn't fit the theme","This game now gets frequent updates and 
attention"}

UITEXT = ""
uicurrent = UI.Text
number1 = string.len(uicurrent)

local function line()
	UITEXT = tableTips[math.random(1,#tableTips)]
if UITEXT == uicurrent then
	print("same")
	while UITEXT == uicurrent do
		UITEXT = tableTips[math.random(1,#tableTips)]
	end
	UI.Text = UITEXT
	uicurrent = UITEXT
	number1 = string.len(UITEXT)
elseif UITEXT ~= uicurrent then
	print("Different")
	number1 = string.len(UITEXT)
	UI.Text = UITEXT
	uicurrent = UITEXT
end

end
while wait(number1 * .01 + 5) do
line()
end

code above I have been working on and rewriting for hours and I cannot for the life of me figure out why it will still pick the same text two times in row after so much work trying to make it do the opposite, I feel as though there is a more simple solution but for the life of me I cannot come to decide what it is

I apologize, but as this is a little messy I’m going to revise it. I can’t see what would stop your code from working anyways. Let me know if this still isn’t working.

loca ui = script.Parent
local tableTips = {"This game was just updated for the first time in 2 years!","Join my Discord server on this game's page for more info.","This game was one of the first games that I ever made","This game has changed alot over the years, There used to be an arena but I figured it didn't fit the theme","This game now gets frequent updates and attention"}

local uicurrent = 0

while true do
	local choice
	repeat choice = math.random(#tableTips) until choice ~= uicurrent
	uicurrent = choice
	ui.Text = tableTips[choice]
	wait(#ui.Text * .075 + 1) -- I think these numbers will be a little nicer, just a hunch.
end
1 Like

You are my savior!
I completely forgot about until

1 Like