of     1   

RepTheNaysh
#214253938Thursday, April 13, 2017 6:56 PM GMT

How would I make a GUI lock on to the position of my mouse while my mouse is inside a certain frame? I have this so far: local Mouse = game.Players.LocalPlayer:GetMouse() GUI = script.Parent GUI.HoverFrame.MouseEnter:connect(function() GUI.TooltipFrame.CFrame = Mouse.Position end) The code in the function doesn't work, of course. Any help?
Wrathsong
#214254039Thursday, April 13, 2017 6:58 PM GMT

mouse.X, mouse.Y
RepTheNaysh
#214254652Thursday, April 13, 2017 7:10 PM GMT

So something like GUI.Frame.Position = UDim2.new(0,Mouse.X)}, {UDim2.new(0,Mouse.Y) I'm generally unfamiliar with UDim2. I will consult the Wiki.
Wrathsong
#214254784Thursday, April 13, 2017 7:12 PM GMT

UDim2.new(0, Mouse.X, 0, Mouse.Y) -- yes
RepTheNaysh
#214255044Thursday, April 13, 2017 7:17 PM GMT

Okay. How would I make it so that the Frame follows the mouse as long as it's inside the HoverFrame? Something like this:? HoverFrame.MouseEnter:connect(function() Mouse:Move(function() GUI.Frame.Position = UDim2.new(0,Mouse.X,0,Mouse.Y) end) end) Not sure about the :Move() thing, it says "attempt to call method 'Move' (a userdata value)"
Wrathsong
#214255232Thursday, April 13, 2017 7:20 PM GMT

Mouse:Move should be Mouse.Moved as it's an event which you used . for, : is used for methods local inside = false HoverFrame.MouseEnter:connect(function() inside = true end) HoverFrame.MouseLeave:connect(function() inside = false end) Mouse.Moved:connect(function() if inside then GUI.Frame.Position = UDim2.new(0,Mouse.X,0,Mouse.Y) end end)
RepTheNaysh
#214255457Thursday, April 13, 2017 7:25 PM GMT

Works great, except you have to use "Move" instead of "Moved". Idk, just says Moved is invalid. Moved would seem more logical, but eh. Super thanks. Been wanting to make something using this for quite some time.
Wrathsong
#214255676Thursday, April 13, 2017 7:29 PM GMT

oh k i wasnt sure if it was Move or Moved np

    of     1