How do I detect if a mobile player let's go of one of my custom buttons I made

I’m trying to make a function start when a player presses a button and stop when that player lets go of it.

I can’t find a way to get it so that the function inside of the function gets triggered when a player lets go of my custom buttons

Here’s my code


function OverCharged()
if Eqipped == true then
OverChargedHold:Play()
OverChargedOn:FireServer()

		UIS.InputEnded:Connect(function(input, gameProcessedEvent) ========= im trying to make this function run when the player lets go of the custom button

			if input.UserInputType == Enum.UserInputType.MouseButton1 then
				OverChargedOff:FireServer()
				OverChargedHold:Stop()
		end
	end)
end

end

local mobilebuttonL1 = contextActionService:BindAction(“OverCharged”,OverCharged,true,“MouseButton1”,“MouseButton1Up”)
contextActionService:SetPosition(“OverCharged”,UDim2.new(0.72,-25,0.20,-25))
contextActionService:SetImage(“OverCharged”,“http://www.roblox.com/asset/?id=68437731”)

local mobilebuttonF = contextActionService:BindAction(“Lantern”,Lantern,true,“F”)
contextActionService:SetPosition(“Lantern”,UDim2.new(1,-25,0.20,-25))
contextActionService:SetImage(“Lantern”,“http://www.roblox.com/asset/?id=68437731”)


Pappararrar@

You have it here.

1 Like

you may use this command:

and if player don’t have keyboard he/she playing on tablet or mobile.

local UserInputService = game:GetService("UserInputService")
local hasKeyboard = UserInputService.KeyboardEnabled
print(hasKeyboard)
local hasnotKeyboard = UserInputService.KeyboardDisabled
print(hasnotKeyboard)

or

local UserInputService = game:GetService("UserInputService")
 
if (UserInputService.KeyboardEnabled) then
	print("The user's device has an available keyboard!")
else
	print("The user's device does not have an available keyboard!")
end
1 Like

That is a Remote event fired to the server, that stops the lantern from being overcharged via the server. the problem is how do I make it fire when the player stops holding down the button on mobile

Thank for the help but how would this help me detect if a mobile player let’s go of a custom button? so I can fire the “OverCHargedHold:Stop()” command in the button release

Heres the custom button I have