Hello devforum, I am trying to make aiming in a gun using mouseButton2, but it overwrites the roblox mouseButton2 drag. How could I fix that?
I have tried using bindActionAtPriority, but it still gets overwritten
This is the code:
contextActionService:BindActionAtPriority("AimGun", aimRightClick, false, 5, Enum.UserInputType.MouseButton2)
local function aimRightClick(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
aimCamera(defaulFieldOfView - AIM_AMOUNT)
makeCrossHairSmaller(crossHairMovementAmount, 0.001)
elseif inputState == Enum.UserInputState.End then
aimCamera(defaulFieldOfView + AIM_AMOUNT)
makeCrossHairBigger(crossHairMovementAmount, 0.001)
end
end
local function aimCamera(fieldOfView)
local goalProp = {}
goalProp.FieldOfView = fieldOfView
local tweenAim = TweenInfo.new(0.15) --change this to the speed you want the player to aim
local tween = game.TweenService:Create(camera, tweenAim, goalProp)
tween:Play()
end
Thanks for reading!