Help with mouse stuff

So basically I need to tell when the players mouse goes into a Gui Frame, then I need to tell where they clicked inside of said frame.


This is probably really easy but here I am!


Note I do already know how to tell when the mouse enters a gui frame so dont worry about that

Use this

gui.InputBegan:Connect(function(inputObject)
     if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
          -- Mouse entered
     end
end)

gui.InputEnded:Connect(function(inputObject)
     if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
          -- Mouse entered
     end
end)

Note that this doesn’t handle touched inputs very nicely. I’m using this ButtonHighlightModel class to handle all of the input stuff in my game.

local model = maid:Add(ButtonHighlightModel.new(button)

maid:GiveTask(model.IsHighlighted:Observe():Subscribe(function(isHighlighted)
     print("IsHighlighted", isHighlighted)
end))

-- Animation
maid:GiveTask(model:ObservePercentHighlight():Subscribe(function(percent)
     button.UIScale.Scale = 1 + 0.1*percent
end))