Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to check if a Player has let go of a Mobile Button?

Hey there,

i’ve made and defined this Mobile button which Fires a Remote event and sends a string when pressed however i need it to also Send another string when they let go of the Button, How would i check for this?, is there a simple way

Script:

function ButtonPress() -- Mobile
	replicatedStorage.Sprint:FireServer("Began")
end

local mobilebutton = contextaction:BindAction("Sprint",ButtonPress,true)
contextaction:SetPosition("Sprint",UDim2.new(0.72,-80,0.30,-35)) -- ZXY
contextaction:SetTitle("Sprint","Sprint")

Thanks,

1 answer

function ButtonPress(actionName, inputState, inputObject) -- Mobile
	if inputState == Enum.UserInputState.Begin then
		replicatedStorage.Sprint:FireServer("Began")
	else
		replicatedStorage.Sprint:FireServer("Ended")
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.