Infinity GUI pop-up

Hello, I am trying to make a game, where ads will pop up infinitely, basically I need to clone GUIs all over the screen.

So the issue is, I have GUIs but I dont know how to make the pop-up thing.

This topic is very unclear in roblox tutorial, so giving me the link to the “Intro To GUIs” wont help me much.

UPD:
I want to make a game where ‘ads’(pictures) will infinitely pop up in RANDOM position on screen ; there is a cross on ‘ad’ so players will be able to close these ‘ads’ so pictures mustnt disappear on screen , only appear.

1 Like
local ads = script.Parent --this is Frame
while true do
 ads.Visible = true
 task.wait(15)
 ads.Visible = false
 task.wait(100)
end
 

Ads must pop up randomly all over the screen (not just being visible and invisible) , I mean in any position for example with math random and in this is the issue : how to make a script which pops up ads in a random position?

I’m not sure what do you mean with “random position”, but if you want to make ads pop-up randomly between a minimum time and a maximum time, just create a loop which waits randomly between two numbers (I’m assuming there’s a close button on the frame you’re making visible).

local Seed = Random.new()

local MinTime = 10
local MaxTime = 120

local Frame = script.Parent

while true do
	task.wait(Seed:NextInteger(MinTime, MaxTime))
	
	Frame.Visible = true
end
local ads = script.Parent --this is Frame
local random = Random.new()
while true do
	local number = random:NextNumber(0.1, 0.9)
	ads.Visible = true
	ads.Position = UDim2.new(number,0,number,0)
	task.wait(1)
	ads.Visible = false
	task.wait(1)
end

I need user to click cross icon, and until that happens, GUIs are still cloning each other. Clikcing the cross will close only one of them.

I have 10 pictures right now, and I need them to pop-up one by one. Basically I want GUIs to spam until they cover all of the screen and beyond. THEY MUSTNT DISSAPEAR UNTIL USER PRESSED CROSS ICON

please anyone? I need a solutio for this

You can just mess up around with math.random and ads.Position, here is just a random script.

local cross = script.path.to.your.cross
local minNumber = 1
local MaxNumber = 1000
local randomNumbers = math.random(minNumber - MaxNumber)

game.Players.PlayerAdded:Connect(function(plr)
while true do
ads.Visible = true
ads.Position = UDim2.new(randomNumbers,0,randomNumbers,0)
wait(1)
ads:Clone()
ads.Position = UDim2.new(randomNumbers,0,randomNumbers,0)
cross:MouseButton1Click:Connect(function()
local randomAdToDelete
for i,v in pairs(plr.PlayerGui:GetChildrens) do
if v:IsA("ScreenGui") then -- replace screengui to whatever it is 
if v.Name == "Ad" then -- replace 'Ad' to whatever your ad frame is named
randomAdToDelete = v
randomAdToDelete:Destroy()
end

Since we did while true do, ads will still pop up after the :Destroy() function. Hope this help! Tell me if there is any errors.

1 Like


it doesnt even spawn, nor clone did you even use studio? at first there was tons of errors, but now when i fixed some of them it even doesnt tell me the error. can you please be more specific because i am new to this

You didn’t specify ‘ads’ or ‘cross’. You need to replace cross to where is your close. But you would need to specify ads, so here is the new script:

local minNumber = 1
local MaxNumber = 1000
local randomNumbers = math.random(minNumber - MaxNumber)

game.Players.PlayerAdded:Connect(function(plr)
local ads = plr.PlayerGui.ScreenGui:WaitForChild("fr1")
while wait(2) do
ads.Visible = true
ads.Position = UDim2.new(randomNumbers,0,randomNumbers,0)
wait(1)
ads:Clone()
ads.Position = UDim2.new(randomNumbers,0,randomNumbers,0)
cross:MouseButton1Click:Connect(function()
local randomAdToDelete
for i,v in pairs(plr.PlayerGui:GetChildrens) do
if v:IsA("ScreenGui") then -- replace screengui to whatever it is 
if v.Name == "Ad" then -- replace 'Ad' to whatever your ad frame is named
randomAdToDelete = v
randomAdToDelete:Destroy()
end