I want to make it so when Button1Down is clicked the brick will get dragged AND while Button1Down is held it will continue to drag until the person lets go of Button1Down. I imagine Button1Down and Button1Up is used for this?
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local clicked = false
mouse.Button1Down:connect(function()
clicked = true
while clicked do wait(0.01)
if mouse.Target.Name == "Dough" then
mouse.Target.Position = mouse.Hit.p
end
end
end)
mouse.Button1Up:connect(function()
clicked = false
end)
What seems to happen is that I click once and hold and if I leave the mouse in place the brick will bounce up and down, as soon as I start to move the brick around it stops moving I think because the mouse moves too fast than the brick can move. How can I fix this?
