How do i make gui appear when i hover over another gui

i want to make it so that when i hover my mouse over main for 0.5 seconds viewframe becomes visible but if i take my mouse off of main it wont become visible and if i hover my mouse over main again i have to wait 0.5 seconds again

local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local main = script.Parent.Abbreviate
local viewframe = script.Parent.NotAbbreviate

local mouseEnter = coroutine.wrap(function()
	task.wait(0.5)
	viewframe.Visible = true

end)

main.MouseLeave:Connect(function()
	
	coroutine.close(mouseEnter)		
	
	viewframe.Visible = false
end)

main.MouseEnter:Connect(function()
	mouseEnter()
end)
1 Like
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local mouse = player:GetMouse()

local main = script.Parent.Abbreviate
local viewFrame = script.Parent.NotAbbreviate

local setVisibleThread
local function setVisible()
	viewFrame.Visible = true
end

main.MouseLeave:Connect(function()
	if setVisibleThread then
		task.cancel(setVisibleThread)
		setVisibleThread = nil
	end

	viewFrame.Visible = false
end)

main.MouseEnter:Connect(function()
	if setVisibleThread then return end
	setVisibleThread = task.delay(0.5, setVisible)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.