Will my script still work on mobile?

I am trying to make a gun, and I just want to know if this script can work on Mobile/Tablet, and what changes I should make if it doesn’t. Please help!

mouse.Button1Down:Connect(function()
	if player.Character:FindFirstChild(gun.Name) and not player.Backpack:FindFirstChild(gun.Name) then
		activated()
		if mouse.Target then
			if mouse.Target.Parent:FindFirstChild("Humanoid") then
				local humanoid = mouse.Target.Parent.Humanoid
				gun.DamageEvent:FireServer(humanoid, dmgValue)
			end
		end
	end
end)

You can take a look at this and you could UserInputService.TouchStarted to detect if the player is using a mobile device. Use an If statement for this. And I think you should use TouchTap instead of Button1Down for mobile.

image

You can always emulate a device’s perspective using this device/resolution bar in studio.

In the event that Button1Down doesn’t fire for touchscreen devices you can switch Button1Down to Activated.