FPS Gun Animation Error?

I was trying to fix some errors with the FE Gun Kit, and I couldn’t fix this one, does anyone have any ideas to fix this?

Code:

			if CommonVariables.ActuallyEquipped and CommonVariables.CanCancelReload then
					print(CurrentVMAnimTable.VMReloadAnim)
					if CurrentAnimTable.TacticalReloadAnim and CurrentAnimTable.TacticalReloadAnim.IsPlaying then
						CurrentAnimTable.TacticalReloadAnim:Stop()
						CommonVariables.Reloading = false
					else return
					end
					if CurrentVMAnimTable.VMTacticalReloadAnim and CurrentAnimTable.VMTacticalReloadAnim.IsPlaying then
						CurrentVMAnimTable.VMTacticalReloadAnim:Stop()
						CommonVariables.Reloading = false
					else return
					end
					if HandleToFire[CurrentFireMode].TacticalReloadSound.Playing then
						HandleToFire[CurrentFireMode].TacticalReloadSound:Stop()
						CommonVariables.Reloading = false
					else return
					end
					if CurrentAnimTable.ReloadAnim and CurrentAnimTable.ReloadAnim.IsPlaying then
						CurrentAnimTable.ReloadAnim:Stop()
						CommonVariables.Reloading = false
					else return
					end
					if CurrentVMAnimTable.VMReloadAnim and CurrentAnimTable.VMReloadAnim.IsPlaying then
						CurrentVMAnimTable.VMReloadAnim:Stop()
						CommonVariables.Reloading = false
					else return
					end
					if HandleToFire[CurrentFireMode].ReloadSound.Playing then
						HandleToFire[CurrentFireMode].ReloadSound:Stop()
						CommonVariables.Reloading = false
					else return
					end					
				end
				break

Error:

Workspace.RealMysticall.HK416A5.GunClient:1515: attempt to index nil with 'IsPlaying'```

can you show what CurrentAnimTable is

attempt to index nil with IsPlaying probably means that the table value you called the method on is nil. You will have show us more code to give us more context on what all of these variables are set to or you could debug yourself with prints.

In response to what @sybrand725 said, it is a folder with the animations in it

The error message suggests that there is an attempt to index a variable with the value of nil using the key 'IsPlaying' . In the provided code snippet, there are multiple potential locations where this error can occur. To fix this, you need to ensure that the variables being accessed are not nil before trying to access their properties or methods.

if CommonVariables.ActuallyEquipped and CommonVariables.CanCancelReload then
    print(CurrentVMAnimTable.VMReloadAnim)
    
    if CurrentAnimTable.TacticalReloadAnim and CurrentAnimTable.TacticalReloadAnim:IsPlaying() then
        CurrentAnimTable.TacticalReloadAnim:Stop()
        CommonVariables.Reloading = false
    elseif CurrentAnimTable.TacticalReloadAnim then
        return
    end
    
    if CurrentVMAnimTable.VMTacticalReloadAnim and CurrentVMAnimTable.VMTacticalReloadAnim:IsPlaying() then
        CurrentVMAnimTable.VMTacticalReloadAnim:Stop()
        CommonVariables.Reloading = false
    elseif CurrentVMAnimTable.VMTacticalReloadAnim then
        return
    end
    
    if HandleToFire[CurrentFireMode].TacticalReloadSound and HandleToFire[CurrentFireMode].TacticalReloadSound.Playing then
        HandleToFire[CurrentFireMode].TacticalReloadSound:Stop()
        CommonVariables.Reloading = false
    elseif HandleToFire[CurrentFireMode].TacticalReloadSound then
        return
    end
    
    if CurrentAnimTable.ReloadAnim and CurrentAnimTable.ReloadAnim:IsPlaying() then
        CurrentAnimTable.ReloadAnim:Stop()
        CommonVariables.Reloading = false
    elseif CurrentAnimTable.ReloadAnim then
        return
    end
    
    if CurrentVMAnimTable.VMReloadAnim and CurrentVMAnimTable.VMReloadAnim:IsPlaying() then
        CurrentVMAnimTable.VMReloadAnim:Stop()
        CommonVariables.Reloading = false
    elseif CurrentVMAnimTable.VMReloadAnim then
        return
    end
    
    if HandleToFire[CurrentFireMode].ReloadSound and HandleToFire[CurrentFireMode].ReloadSound.Playing then
        HandleToFire[CurrentFireMode].ReloadSound:Stop()
        CommonVariables.Reloading = false
    elseif HandleToFire[CurrentFireMode].ReloadSound then
        return
    end
end

Found an easier solution; went into settings and disabled cancelReload. :man_shrugging:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.