Well, I have a problem, and it is that the following script moves the position of the textbutton depending on the Y position of the mouse when pressing the textbutton, it does it itself but outside the limits UDim2.new (1, 0, 1, 0) and I don’t know how to solve it
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()
local Button = script.Parent.TextButton
Button.MouseButton1Down:Connect(function()
mouse.Move:Connect(function(Y)
Button:TweenPosition(UDim2.new(0.5, 0, mouse.Y, 0))
end)
end)
It works for me but it does not move at the same time as the mouse, causing it to go down a little and I have to go down more so that it goes down another little, it is as if it were stuck
It also works for me but it is slow because if I stop moving the mouse, it stops moving towards the position it was moving and not the mouse because it is stuck a bit
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()
local Button = script.Parent.TextButton
Button.MouseButton1Down:Connect(function()
mouse.Move:Connect(function(Y)
Button:TweenPosition(UDim2.new(0.5, 0, mouse.Y/mouse.ViewSizeY, 0), Enum.EasingDirection.Out,EasingStyle.Sine,.25,true)
end)
end)
my hope is that this should be less slow, tween position defults time to 1 second, and the override is optional I just think it would work in this circumstance