Image button and MouseButton1Down issue

I have two mobile buttons that turn my vehicle left and right. If you hold down on the left button and slide your finger to the right button, the vehicle will fire the button indefinitely (and vice versa). Here is the script inside the image button that enables the script in that button to control the steering:

script.Parent.MouseButton1Down:Connect(function()
	script.Parent.leftscript.Disabled = false
end)

script.Parent.MouseButton1Up:Connect(function()
	script.Parent.leftscript.Disabled = true
end)

How can i recode this so that it registers when the finger leaves the gui button and not just when it has lifted up off the surface?

i dont know about mobile controls all too well, however maybe try using GuiObject.MouseLeave?

1 Like

MouseLeave and Enter is for mouse movement and wont work on mobile anymore, thanks though.

I tried it and it is working in Emulator… let me test on real mobile device and if works I will mark your suggestion as the solution.

SO it works, contrary to what i read posted in the Bugs section of the forum… maybe it has reverted and been fixed since then. Either way thanks for the suggestion or I wouldnt have tried it!!

1 Like