Issue with trying to make my script mobile compatible

This script is one of 3 scripts being used this script currently tells the other 2 scripts when to pick up and to drop/throw a part, It worked before but this is the current script I changed it to and it doesnt work. I am assuming the issue revolves around the “if function onButtonPress()” part since it was different before. Is there anyway to make this work, I am trying to use “onButtonPress()” to make it mobile compatible

Previously, I’ve had the script so that where it says “if function onButtonPress() then” would say “if input.KeyCode == Enum.KeyCode.F then” and that seemed to work. I’m trying to use “function onButtonPress()” to make it mobile compatible but hasnt worked so far.

I’ve tried using both in one script by doing “if input.KeyCode == Enum.KeyCode.F or function onButtonPress() then” but that didnt work either.

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local uis = game:GetService("UserInputService")
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script.GrabBlockAnim)
local CanGrabBlock = true
local contextActionService = game:GetService("ContextActionService")

local function Block(plr, block)
	if CanGrabBlock == true then 
		CanGrabBlock = false
		anim:Play()
		game.ReplicatedStorage.TakeBlock:FireServer(plr, block)
		uis.InputBegan:Connect(function(input, GameprocessedEvent)
			if function onButtonPress() then
				game.ReplicatedStorage.ThrowBlock:FireServer(plr, block)
				anim:Stop()
				wait(1)
				CanGrabBlock = true
			end
		end)
	end
end

game.ReplicatedStorage.ClientBlock.OnClientEvent:Connect(Block)
local mobilebutton = contextActionService:BindAction("ThrowBlock",onButtonPress(),true,"f")```

Basically, In simple terms, this script makes it so that when the letter F is pressed the part gets placed down, I’ve changed the script to what it is at the moment to try to make it so that when a button is pressed on mobile it does the same thing as pressing F on computer but I cant seem to get it to work.