How to make a left mouse click?

Hello! Could someone help me please?
I would like to know how to replace this script:

UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
	if input.KeyCode == Enum.KeyCode.E then
		print("E pressed, playing the anim")
		local playAnim = humanoid:LoadAnimation(anim)
		playAnim:Play()
		script.Anim:FireServer()
	end
end)

I need to make the left mouse button press
How do I make a print when the left mouse button is pressed?

3 Likes
UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("LMB pressed, playing the anim")
		local playAnim = humanoid:LoadAnimation(anim)
		playAnim:Play()
		script.Anim:FireServer()
	end
end)
2 Likes

Thanks you a lot!!! :smiley: it works perfectly

On another note, if you want to rather bind and unbind the action, use ContextActionService.