Passing an array data to peers from a function called if get_tree().is_network_server()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By shreyk27

I am currently working on 2d card trading multiplayer game ( 4 Players ). The game consists of 4 Players sitting round a table and get equal amount of cards, shuffled. The cards in the game are loaded from a JSON file with image paths, id, suit type, etc. and then are stored in an array ( allInstances = [] ).

I implemented a function namely loadCardData() for the card loading process and a function chunk() that splits the allInstances array into 4 equals ( 52 cards = 4 * 13 ) inside an array named chunked_arr[]. Function loadCardData() contains a randomize function that shuffles the position of cards which is good, but it jumbles the cards for every player in every peer and all the player gets different cards in all the connections which is not desired i am desiring a single player let’s say Player to have same type of cards in all the peer connection. So i instead added a condition to the script

if get_tree.is_network_server():
    loadCardData()      # Load Cards into allInstances 
    chunk(allInstances, 13)    #split array into equals and store in 
                                chunked_arr

But this does work for the server as chunked_arr get data but the clients chunked_arr seems to store no data. How should i go about passing the chunked_arr data to the clients.