local mouseButton = "" -- Outside of the scope of both functions, so both can use this variable.
UserInputService.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 then -- Left mouse button
mouseButton = "LEFT"
Tool:Activate()
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then -- Right mouse button
mouseButton = "RIGHT"
Tool:Activate()
end
end)
Tool.Activated:Connect(function()
if mouseButton == "LEFT" then
-- Do light attack things here
elseif mouseButton == "RIGHT" then
-- Do heavy attack things here
end
end)
not mine but works
post: Can you activate a tool using the right mouse button? - #3 by punyman9?