Gun stops firing when moving finger on mobile

Hello, i have a problem:

As you can see, if i move my mouse gun stops firing. Same thing happens on mobile, when i move my finger the gun stops firing.
I know why this happens, i think. It’s because of my script:

	ContexAction:BindAction("Shot",function(name,state,obj)
		if state == Enum.UserInputState.Begin then -- starts when my mouse button down
			fire()
		else -- stops when my mouse button up or i moving the mouse
			stopfire()
		end
	end,true,Enum.UserInputType.MouseButton1)

I need change this method to fix this, any ideas?

5 Likes

It’s because there are more UserInputStates than Begin and End, in this case Change is the one being returned when moving your finger. You need to check if the state actually is Enum.UserInputState.End when you want to stop.

2 Likes

Okay, I’ll try it, but later, i can’t right now.

1 Like

Yes, this is works! Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.