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

Can you use Mouse.Taregt for GUI's? And how you do it??

! This is not a request. I just cant find how to do it anywhere so I am asking for help here!

So basically I want to make a LocalScript that opens a frame when the players mouse hovers over a button , and closes it when the player mouse is not over the button.

local pm = game.Players.LocalPlayer.GetMouse()
local frame= script.Parent.Frame
local button = script.Parent.Label

Can someone tell me how to do it?

4 comments

0

Just do bunch of maths with mouse.X and mouse.Y

0

button.Touched:Connect()

1 answer

✓ Accepted answer

What you're looking for is Button.MouseEnter and Button.MouseLeave

you'd use the Button.MouseEnter to make the gui visible you'd use the Button.MouseLeave to make the gui not visible

example

local Gui = script.Parent.GUICHANGE
local parent = script.Parent

local button = Instance.new('TextButton') 
button.MouseEnter:Connect(function()
	Gui.Visible = true
end)
button.MouseLeave:Connect(function()
	Gui.Visible = false
end)
button.Parent = parent`

2 comments

0

didnt quite work, did you test it yourself?

0

Lol I didn't test it myself because I know how it works lol.. Did you get an error? if so can you post it please?

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