ACS Hold To Aim

So i’m trying to make a hold to aim system for acs 2.0.1 and everything works fine except for when you hold down right mouse button before the tool is equipped and release it while the tool is equipped. Here is an example so it makes more sense:

Here Is The Code Inside Of The ACS_Framework:

5 Likes

The issue seems to be because you are just setting aiming = not aiming which in your case means your right mouse down will do the opposite of what you expect if you hold it down before it’s equipped.

1 Like

I tried Setting it to aiming = true instead but it just breaks and won’t aim in or out

1 Like

You need to check if the RMB is either down / up before setting the value.

1 Like

Do you have an example I can go off of?

1 Like

I can give you a very basic example that you can put into practice yourself.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local aiming = false

Mouse.Button2Down:Connect(function()
    --run a check to see if the gun is equipped before setting it to true
    if gunEquipped then
        --you'd only want this set to true if you're gun is equipped.
        aiming = true
    end
	
end)

Mouse.Button2Up:Connect(function()
	aiming = false
end)

If you have any further questions let me know.

1 Like

For those wondering, I finally fixed the issue after 1 1/2 days straight working to fix this

Here is the final working code:


In order for this to work, you must go into the ACS_Framework script in startercharacterscripts and press ctrl+F and Search For

CAS:BindAction(“ADS”, handleAction, true, Enum.UserInputType.MouseButton2, Enum.KeyCode.ButtonL2) then delete it.

After that search for

CAS:UnbindAction(“ADS”)
and delete it

after you delete both of those press ctrl+F again and search for

if actionName == “ADS” and inputState == Enum.UserInputState.Begin and AnimDebounce then
if WeaponData and WeaponData.canAim and GunStance > -2 and not runKeyDown and not CheckingMag then
aimming = not aimming
ADS(aimming)
end

	if WeaponData.Type == "Grenade" then
		GrenadeMode()
	end
end

once you find it delete it and replace it with the code shown in the final code image.
if you have any questions feel free to reply to this.

8 Likes