Greetings, i wish to be able to detect where the players mouse is with the center of the screen being the “0” point. Heres a diagram.
the mouse.X and mouse.Y properties are obviously insufficient for this.
All help appreciated.
Greetings, i wish to be able to detect where the players mouse is with the center of the screen being the “0” point. Heres a diagram.
the mouse.X and mouse.Y properties are obviously insufficient for this.
All help appreciated.
I have figured it out, for those wondering.
local mouse = game.Players.LocalPlayer:GetMouse() -- getting the mouse
local center = game.Workspace.CurrentCamera.ViewportSize / 2 -- getting the middle of the screen
local pos = Vector2.new(mouse.X,mouse.Y) -- compiling a mouse position
local mag = (center - pos) -- comparing the center and the mouses position
print(mag.X)
if mag.X > 0 then
print("its on the left")
elseif mag.X < 0 then
print("its on the right")
end```