MouseClickButton in cell phone

How can I tell the script that when the player presses the button, it is to shoot?

local cas = game:GetService("ContextActionService")

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()

local function buttonPressFunction()
	
	MouseButton1Click:Connect(function()
end)
	
	char:UnbindAction("ExtraFireButton")
end

local button = cas:BindAction("ExtraFireButton", buttonPressFunction, true)

cas:SetPosition("ExtraFireButton", UDim2.new(0.58,0,0.15,0))

You need to utilize RemoteEvent.

Links about it can be found here:

1 Like

You’re missing an argument for :BindAction.

cas:BindAction("Name", callback, true, Enum.KeyCode.SomeThing)
-- Name, callback, create touch button, Enum.KeyCode.*
1 Like

I discovery out how to “say” is the mouse, but I don’t know how to “say” to function what it should do.

local cas = game:GetService("ContextActionService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local RemoteEvent = game.ReplicatedStorage.Mobile.Fire
local UserInputService = game:GetService("UserInputService")

local function buttonPressFunction()
UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
end

local button = cas:BindAction("ExtraFireButton", buttonPressFunction, true,Enum.UserInputType.MouseButton1)