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

how can i make 3 GUI's move when there is another GUI in it's place?

i want three GUI frames that look like this: https://gyazo.com/af575e66f3fb4b0b69498ed35fbd7394 and it's confusing me on how i can make it so if there's a GUI in the 1st position when another GUI is triggered, it goes on top of it and also if one disappears, the other moves into place. here's my script

local debounce = 0
function eventHappens(hit)
	if debounce == 0 then
	print('cp1 success')
	debounce = 1
	local check = hit.Parent:FindFirstChild("Humanoid") 
		
	if check ~= nil then 
		print('cp2 success')
		user = game.Players:GetPlayerFromCharacter(hit.Parent)
		print('cp3 success')
		guis = 0
			if guis == 0 then
				guis = 1
				script.Parent.Parent.Parent.POS1.Visible = true
				script.Parent.Parent.Parent.Enabled = true
				script.Parent.Text = string.format(user.Name.." has robbed $50,000 from the bank")
				wait(5)
				script.Parent.Parent.Parent.Enabled = false
				wait(10)
				guis = 0
				end
			elseif guis == 1 then
				guis = 2
				script.Parent.Parent.Parent.POS2.Visible = true
				script.Parent.Parent.Parent.Enabled = true
				script.Parent.Text = string.format(user.Name.." has robbed $50,000 from the bank")
				wait(5)
				script.Parent.Parent.Parent.Enabled = false
				wait(10)
				guis = 1
			elseif guis == 2 then
				guis = 3
				script.Parent.Parent.Parent.POS3.Visible = true
				script.Parent.Parent.Parent.Enabled = true
				script.Parent.Text = string.format(user.Name.." has robbed $50,000 from the bank")
				wait(5)
				script.Parent.Parent.Parent.Enabled = false
				wait(10)
				guis = 2
			end
	debounce = 0
			
	end
end
game.Workspace.BankMoneyGiver.Head.Touched:connect(eventHappens)

1 answer

You're going to have to do something similar to 2D Collision to detect whether or not there is a UI element above the current element or if the element has reached the top of the screen

Pseudo: `IF' FRAME 'is colliding with' OTHER_FRAME 'THEN'

DONT CHANGE FRAME POSITION

'ELSEIF NOT' OTHER_FRAME 'THEN'

CHANGE FRAME POSITION UNTIL IT REACHES TOP FO SCREEN

'END"

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