I am trying to attempt to make it so when a player clicks a button it spawns a frame that tweens to the size and position of the button they pressed. And the position of the frame is the mouse position.
But for some reason the frame always seems to start in the top left of the button..
Heres the code
v.MouseButton1Down:Connect(function() local SqaureBox = Instance.new("Frame") local ScaleX = Mouse.X / Mouse.ViewSizeX local ScaleY = Mouse.Y / Mouse.ViewSizeY print(ScaleX, ScaleY) SqaureBox.Position = UDim2.new(0, ScaleX, 0, ScaleY) SqaureBox.Parent = v SqaureBox.ZIndex = 5 SqaureBox.BorderSizePixel = 0 SqaureBox.BackgroundTransparency = .5 SqaureBox:TweenSizeAndPosition(UDim2.new(1, 0, 1, 0), UDim2.new(0, 0, 0, 0), "InOut", "Quad", .25, true) wait(.25) SqaureBox:Destroy() end)
Also heres a gif of whats happening
https://gyazo.com/ca15c39b1cf284025590974baeaa92f9
You see how the grey frame always start in the top left when I am trying to get it to start on the mouse position.
Thank you for your time :)