When mobile players drag finger on screen it places block

I am working on a tool that allows you to place blocks and I have run into a issue that happens for mobile users. When they drag their screen to change camera perspective it places a block. I have tried finding other posts about this issue and searching on youtube for answers but got none.
Here’s the script that fires the function.

local Uis = game:GetService("UserInputService")

    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
    	spawnpart()--Function that spawns part

You should make your local script check whether KeyboardEnabled is true or not, if it’s not, make the script behave differently.

For example, toggling a placement mode for mobile players, where they have to click a button on their screen to place stuff (building mode, basically).

1 Like