Randomly appear a GUI

Howdy! I wanted to make a Tips Screen whenever you’re on a loading screen,
for example, I click a button and 1/20 tips/button will appear, or maybe 1/30?
and how can It appear randomly?

Here’s an example script I made

local Mainbutton = script.Parent.TextButton

function Clicked()
	local numbers = math.random(1, 30) --chooses a number between 1 to 30 
	print("You got number" ..numbers)
	if numbers == 5 then -- if the chosen number is 5
		print("You Got 5! A button will appear in a sec.")
		task.wait(4)
		for i = 1, 10 do
			Mainbutton.TextButton.TextTransparency -= 0.1
			Mainbutton.TextButton.BackgroundTransparency -= 0.1
			task.wait(0.02)
		end
	end
end

Mainbutton.MouseButton1Click:Connect(Clicked)

If you don’t understand what I mean, kindly message me

3 Likes

what exactly isnt working with the script you made?

1 Like

no, there is no problem with the script

1 Like

Not entirely sure what you want, but I’m assuming that you want to make the tip appear instead of the number on the textbutton.

I would use a tips table at the beginning of your script:

local tips = {"insert tip here", "insert another tip here"} -- add more tips until all the tips are there.

then set the text of the button to the number in the table before the button appears like this:

Mainbutton.TextButton.Text = tips[numbers]

Make sure that the length of the table is the same as the maximum value of the numbers variable.

4 Likes

ty this perfectly worked

This text will be blurred

1 Like