Have you tried adding a wait function (out of the loops) in between removing the items from the bag and putting the new items in?
You could also remove "If Bagslot Equal to 1" from the trigger, and use 'For each (Integer A)' for both the top and bottom
If BagSlot == 0
Then
For each (Integer A) from 1 to 6, do (Actions)
Hashtable Save Handle Of (Item Carried by (Casting unit) in slot (Integer A) as 0 of (Integer A) in HashItem(0)
Else
For each (Integer A) from 1 to 6, do (Actions)
Hashtable Save Handle Of (Item Carried by (Casting unit) in slot (Integer A) as 0 of (Integer A) in HashItem(1)
For each (Integer A) from 1 to 6, do (Actions)
Item - Remove [(Item carried by Casting unit in slot (Integer A)]
Wait 0.1
If BagSlot == 0
Then
For each (Integer A) from 1 to 6, do (Actions)
Hero - Create (Item-type of (Load 0 of (Integer A) in HashItem(0)) and give it to (Casting unit)
Else
For each (Integer A) from 1 to 6, do (Actions)
Hero - Create (Item-type of (Load 0 of (Integer A) in HashItem(1)) and give it to (Casting unit)