Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

! 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?

0
Just do bunch of maths with mouse.X and mouse.Y User#24403 69 — 5y
0
button.Touched:Connect() hellmatic 1523 — 5y

1 answer

Log in to vote
0
Answered by
IDKBlox 349 Moderation Voter
5 years ago
Edited 5 years ago

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`

0
didnt quite work, did you test it yourself? Vibesgus 35 — 5y
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? IDKBlox 349 — 5y
Ad

Answer this question