So I am making a custom animator and Im at the point where I need to make it so you can change what time you are editing at, so I need to make it so you can drag a thing that changes the time to its position basically.
I agree with @FuntMaster here. You could use InputBegan and InputEnded with some checks, but I’d use the player’s mouse. Here’s an example
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Button = Draggable
local mouseMove
local mouseIn
Button.MouseEnter:Connect(function()
mouseIn = true
end)
Button.MouseLeave:Connect(function()
mouseIn = false
if mouseMove then mouseMove:Disconnect() end
end)
Mouse.Button1Down:Connect(function()
if mouseIn then
mouseMove = Mouse.Move:Connect(function()
if not mouseIn then return end
Button.Position = UDim2.new(0, Mouse.X, 0, 0)
end)
end
end)
Mouse.Button1Up:Connect(function()
if mouseMove then
mouseMove:Disconnect()
end
end)