game:GetService("UserInputService").InputChanged:connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseMovement and Dragging == true then inputPosition = UDim2.new(0, Mouse.X-25, 0, Mouse.Y-25) end end)
I even tried to set it too.
game:GetService("UserInputService").InputChanged:connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseMovement and Dragging == true then inputPosition = UDim2.new(0, Mouse.X, 0, Mouse.Y) end end)
And changing the pictures anchor points to .5,.5 but no matter what if your windows size is changed the image ends up on the wrong position.
InputPosition is the images position.
heres a gif of what it does https://gfycat.com/RecentDesertedJunco
and when I do change it to fit my screen if I make the window smaller it messes up. How do I fix it so it stays same place no matter window size
Try this in a LocalScript
local player = game.Players.LocalPlayer local mouse = player:GetMouse() while true do local xm = mouse.X local ym = mouse.Y script.Parent.Position = UDim2.new(0, xm, 0, ym) wait() end
Unfortunately, the Mouse Position can only be read using the offset, rather than the scalar Vector3 properties.
However, you could try this, which would take into account the mouse's position in relation to the absolute screen size, but is an estimation of the placement.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() while true do local xm = mouse.X local ym = mouse.Y local xg = script.Parent.AbsoluteSize.X local yg = script.Parent.AbsoluteSize.Y script.Parent.Position = UDim2.new((1-(xg/xm)), 0, (1-(yg/(2*ym))), 0) wait() end