So I’m making a mobile slider for moving a car forwards or backwards and I’m listening for when the user pressed the slider and then depresses to stop moving the car. My problem is that what I’m using (Slider.MouseButton1Up) doesn’t fire if the finger/mouse exited the button before unpressing.
Does anybody know any other way to check if the finger that pressed the button then depressed even when it is out of the slider?
--// Services
local UIS = game:GetService("UserInputService")
--// Variables
local Button = script.Parent
--// State
local isHolding = false
--// Functions
local function Button1Down()
isHolding = true
print("Started Pressing Down")
end
local function InputEnded(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isHolding = false
print("Stopped Pressing Down")
end
end
--// Connections
Button.MouseButton1Down:Connect(Button1Down)
UIS.InputEnded:Connect(InputEnded)
Edit: Just saw that @DeodorantSlice37 just suggested this same idea.
Hi, this is the exact issue. In the game, to make the car jump, you tap on the screen meaning that if you jump, the car would stop driving. I’m wondering if there is a way to detect all the taps and then track their position.
Well it would work but if you would to release your tap somewhere else (which to make the car jump you have to press and release it would make the game think you stopped driving the vehicle which would be really annoying