Fire command when player clicks

How to fire a command when the players simply clicks the left mouse button

Use the UserInputService to determine that.

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		--- CODE HERE
		end
	end)

1 Like