What I am trying to do is make a Aim Cursor follow the mouse, the reason I’m doing this is because the game would have scoping integrated in it. Im am using the following code:
local function AimFollowMouse()
Aim.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
end
Connected with a mouse.Move Event.
The aim frame is set up like so:
Some of “stolen models” were used by many people and are in the toolbox, others were built originally, and all the scripts were made by myself, if your not gonna read and use your fundamentals dont say anything lol
You need to add the offset of 20 (I think) on top of the other offset that @bytesleuth mentioned. Or, you can disable the property where the ScreenGui ignores the ingame core gui.
20 just makes it flip to the other side of the mouse and it seems that when i turn IgnoreGuiOffset it gets closer to the actual mouse which is good in this case
Ok so i kept the anchor point to 0.5,0.5 and used ur code and it was aligned on the x axis but was still above it, when i added 20 offset to the Y axis it was closer but still not aligned
Hey there, unfortunately, there isn’t a way to calculate this number, as 34 is simply the pixel size of the Roblox topbar. I do however recommend that instead of you adding this number in your calculations, change the ScreenGui’s ScreenInsets property None.
This will make Roblox ignore the topbar, and leave you with the same result.