local plr = game.Players.LocalPlayer
local TS = game:GetService("TweenService")
local mouse = plr:GetMouse()
local buttonUp = true --Status of the left mouse button
mouse.Button1Up:Connect(function()
buttonUp = true --The function is that if the left mouse button is raised, the status changes
end)
script.Parent.MouseButton1Down:Connect(function(x, y)
buttonUp = false
while wait(0.001) do
TS:Create(script.Parent, TweenInfo.new(0.1), {Position = UDim2.new(0, mouse.X, 0, mouse.Y)}):Play()
if buttonUp == true then
break
end
end
end)