i have 2 tools in my starterpack, and when i rightclick, i want the fov to get smaller, then back to 70 when clicked again. when i right click it works, but when i switch to another tool while aimed in, it no longer works... i have no idea why, but im pretty sure it's because of my debounces.
here is one of my tools aiming scripts: (pretty much the same for both)
bat.Equipped:Connect(function()
equipped = true
aiming = false
plr.Character.Humanoid.CameraOffset = Vector3.new(.6,1.7,0)
bat.Equip:FireServer(plr)
mouse.Button2Down:Connect(function()
if equipped == true then
if aiming == false then
aiming = true
workspace.CurrentCamera.FieldOfView = 40
plr.PlayerGui.CrossHair.Aiming.ImageLabel.Visible = true
plr.PlayerGui.CrossHair.NonAiming.ImageLabel.Visible = false
print(aiming)
else
aiming = false
workspace.CurrentCamera.FieldOfView = 70
plr.PlayerGui.CrossHair.Aiming.ImageLabel.Visible = false
plr.PlayerGui.CrossHair.NonAiming.ImageLabel.Visible = true
print(aiming)
end
bat.Unequipped:Connect(function()
equipped = false
aiming = false
workspace.CurrentCamera.FieldOfView = 70
plr.PlayerGui.CrossHair.Aiming.ImageLabel.Visible = false
plr.PlayerGui.CrossHair.NonAiming.ImageLabel.Visible = true
print(aiming)
bat.Unequip:FireServer()
end)
end
end)
end)

2 comments
line 22
could you be more specific on what to do?