As the title says, I’ve been trying to find a way to detect my mouse’s position inside a Frame.
For example when player clicks in the Frame it would print the position inside the frame where the player clicked.
The problem is, I have no idea how to do this and if anyone could drop any hints for me that would be very helpful and appreciated!
All you need to do is check when the frame is clicked on and then subtract the mouse’s position by the frame’s absolute position.
local frame = FRAME
local function inputBegan(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local position = input.Position - frame.AbsolutePosition
--do stuff with it
end
end
frame.InputBegan:Connect(inputBegan)