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:
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.
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)
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.