How to get the Players mouse Position in Udim2?

Hi Other Developers,
I’ve been running into this problem where I don’t know how to get the Player’s Mouse Position in Udim2

Here is my code:

local PlayerMouse = game.Players.LocalPlayer:GetMouse() --// mouse
local function spawnParticles()	
	ParticleInstance.Position = Mouse.Position -- here is the issue
end

Thanks a lot!

You can use Mouse.X, and Mouse.Y (represented by pixels from the top-left corner.)

UDIM represents UI measurments in both scale and pixels of a screen (or parent element),

If you… need? the position in scale units for some reason you can always just divide the position on x or y by the appropriate corresponding axis of the screen

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.