I don’t know why, but this aiming script just won’t work for these parts I have for the aiming model. The script works for the most part until I unaim, and the aim down sights model’s transparency won’t go back to 0. Help
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local gun = script.Parent
--UserInputService Setup
local userInput = game:GetService('UserInputService')
--Mouse setup
local mouse = game.Players.LocalPlayer:GetMouse()
aimAnimation = Humanoid:LoadAnimation(script:WaitForChild("AimHold"))
local isEquipped = false
print("Script loaded")
gun.Equipped:Connect(function()
isEquipped = true
end)
gun.Unequipped:Connect(function()
isEquipped = false
end)
mouse.Button2Down:Connect(function()
print(isEquipped)
if not isEquipped then
return
end
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = 40
aimAnimation:Play()
script.Parent.Handle.AimSound:Play()
script.Parent.MaxSpread.Value = 0.6
script.Parent.MainGun.Transparency = 1
script.Parent.Rail.Transparency = 1
script.Parent.FrontSight.Transparency = 1
script.Parent.ForeSight3.Transparency = 1
script.Parent.ForeSight2.Transparency = 1
script.Parent.ForeSight1.Transparency = 1
script.Parent.FakeMag.Transparency = 1
script.Parent.ChargingBolt.Transparency = 1
script.Parent.ChargingBolt2.Transparency = 1
script.Parent.Logo2.Transparency = 1
script.Parent.Logo1.Transparency = 1
script.Parent.Logo2.HFLogo2.Transparency = 1
script.Parent.Logo1.HFLogo.Transparency = 1
--below is the aim model script
script.Parent.AimModel.Transparency = 0
script.Parent.Sight1.Transparency = 0
script.Parent.Sight2.Transparency = 0
script.Parent.Sight3.Transparency = 0
script.Parent.FrontSight2.Transparency = 0
print("Animation Playing")
end)
mouse.Button2Up:Connect(function()
print(isEquipped)
if not isEquipped then
return
end
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = 70
aimAnimation:Stop()
script.Parent.MaxSpread.Value = 0.065
script.Parent.MainGun.Transparency = 0
script.Parent.Rail.Transparency = 0
script.Parent.FrontSight.Transparency = 0
script.Parent.ForeSight3.Transparency = 0
script.Parent.ForeSight2.Transparency = 0
script.Parent.ForeSight0.Transparency = 0
script.Parent.FakeMag.Transparency = 0
script.Parent.ChargingBolt.Transparency = 0
script.Parent.ChargingBolt2.Transparency = 0
script.Parent.Logo2.Transparency = 0
script.Parent.Logo1.Transparency = 0
script.Parent.Logo2.HFLogo2.Transparency = 0
script.Parent.Logo1.HFLogo.Transparency = 0
--below is the aim model script
script.Parent.AimModel.Transparency = 1
script.Parent.Sight1.Transparency = 1
script.Parent.Sight2.Transparency = 1
script.Parent.Sight3.Transparency = 1
script.Parent.FrontSight2.Transparency = 1
print("Fixing camera")
end)