"ifpIndex" is the index of the ifp file you want to load from globalLoadedIfps table, the table contains IFP data, like file path, new block name, the animations of the ifp file, etc.. Instead of sending an entire table via triggerServerEvent or triggerClientEvent which will use more internet bandwidth, we simply send an index of the required table for ifp which will be much faster. Also, can you please login as admin and execute /debugscript 3 on your server? It will show you errors within code on screen if there are any. Also, I just realized that source is also not defined here:
ReplacePedBlockAnimations ( source, 7 ) -- Where is source defined? It is not a predefined variable.
ReplacePedBlockAnimations ( localPlayer, 7 )
localPlayer is a predefined variable on client side. It will always be valid. localPlayer is YOU.
More about predefined variables: https://wiki.multitheftauto.com/wiki/Predefined_variables_list