I am getting 0 errors. I don’t understand why it doesn’t work.
mouse.Button1Down:Connect(function()
if aiming == true then
if reloading == false then
if hasAmmo == true then
if not isInF9 then
if firemode == "auto" then
if not isShot then
shooting = true
isShot = true
while shooting == true do
--local mousePosition = mouseModule.GetPosition()
local mousePosition = mouse.Hit.Position
if reloading then return end
ShootRecoil()
fireEvent:FireServer(mousePosition)
local shootClone = aimAnim:Clone()
local shootTrack = animator:LoadAnimation(shootClone)
shootTrack.Looped = false
shootTrack:Play()
mouse.Button1Up:Connect(function()
shooting = false
spreadEvent:FireServer()
end)
task.wait(firerate)
isShot = false
end
end
elseif firemode =="semi" then
if not isShot then
if reloading then return end
isShot = true
local mousePosition = mouse.Hit.Position
ShootRecoil()
fireEvent:FireServer(mousePosition)
task.wait(firerate)
isShot = false
end
end
end
end
end
end
end)
local function lockEnable()
if lock then
ots:Disable()
lock = false
elseif lock == false then
if tool.Parent:IsA("Model") then
ots:Enable()
lock = true
end
end
end
tool.Unequipped:Connect(function()
shooting = false
aiming = false
equipped = false
animator.AnimationPlayed:Connect(function(anim)
anim:Stop()
end)
if lock == true then
ots:Disable()
lock = false
end
camera.FieldOfView = 70
contextActionService:UnbindAction("Reload")
end)
tool.Equipped:Connect(function()
ots:Enable()
equipped = true
lock = true
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:FindFirstChild('Humanoid')
animator = humanoid.Animator
local equipClone = equipAnim:Clone()
local equipTrack = animator:LoadAnimation(equipClone)
equipTrack:Play()
contextActionService:BindAction("Reload", function(name, state, obj)
if state == Enum.UserInputState.Begin then
reloadEvent:FireServer()
local reloadClone = reloadAnim:Clone()
local reloadTrack = animator:LoadAnimation(reloadClone)
reloadTrack:Play()
end
end, false, Enum.KeyCode.R)
end)