Hello Developers
in my script, roblox is supposed to calculate the mouse location and the viewport size. but what happened is. Roblox studio gave the thing that i want to divide to the viewport size.
to calculate:
569/1366
247/767 Roblox Studio Answer:
= 569
= 247 Microsoft Calculator Answer:
= 0.4165446559297218
= 0.3220338983050847
i fixed it by placing this line to client from server. and changing the script to UserInputService:GetMouseLocation().X / game.Workspace.Camera.ViewportSize.X,UserInputService:GetMouseLocation().Y
That’s because the server’s camera’s ViewportFrame has a resolution of 1x1 (1 pixel by 1 pixel), you need to get the client’s camera instead.
Additionally, you should be fetching the camera via the workspace’s “CurrentCamera” property, its value points/refers to the camera instance itself.
Try executing the following line of code in a server script.