How to get the exact mouse position for guis?

https://gyazo.com/4b88b71fa1967d83bffbfa74799eca3c
its putting the gui below the mouse? im trying to get the guis to go around it and having the mouse being in the center

local Gui = script.Parent
local image = Gui:WaitForChild("ClickEffect")
local UIS = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

UIS.InputBegan:Connect(function(input,isTyping)
	if isTyping then return end
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		local pos = UIS:GetMouseLocation()
		
		image.Position = UDim2.new(0,pos.X,0,pos.Y)
		image:TweenSize(UDim2.new(.122,0,.238,0),Enum.EasingDirection.Out,Enum.EasingStyle.Sine,.1,true)
		task.wait(.1)
		image:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Sine,.15,true)
		
	end
end)

Just use mouse.X and mouse.Y

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

image.Position = UDim2.fromOffset(mouse.X, mouse.Y)
1 Like

still the same problem that changed nothing

Change the anchor point of your gui object? I think .5 .5 would work.

1 Like