This is a good way to send data?

I don’t know if this is the correct category.

I tried to think about a new way to players get the game’s shop data, i don’t have the script, but i have explained it:

Player requests the Shop Data > Server gets the request > Server fires an event for each item in the shop > Player gets each request and clones a frame for each pet.

So, i want to know if this is a good way to send the shop data to players, also i want to say some stuff:

-Data would be sent like this:

:Fire(PetName, Cost, PetId, Description) --That's just the information, the shop is Server Sided.

-I don’t know if i should send this with a cooldown.

If you need more information, then ask me. Thanks for reading.

Repeatedly firing an event for the different items is a bad idea. Instead, you should pack the items into a table and send that table.

Furthermore I strongly recommend you to use Functions instead of Events when requesting data across the network. Events are meant for one-way communication, while Functions allow for simple request-response communication.

Hello! So basically, if i pack every item, how do i know when a desccription/id/cost belongs to an item? Because i think this is how it would look:

local PackedStuff = {Doge, 300, Unicorn, Such doge, 500, Roblox Logo, 100, Rainbows everywhere, Powering Imagination}

You could use a table nested within a dictionary.

ItemList = {

[“Item1”] = {data},
[“Item2”] = {data}

}

I remember that it’s not possible to do that. Item1 and Item2 will return empty. I don’t know where, but it was a post in the devforum, or maybe in the developer hub.

It’s not going to return empty.

I don’t know if i have used the correct word, well, here is a post from the developer hub talking about this:

Please, tell me if i’m wrong or not, i’ve read fast.

Well, it worked for me, returning data that way works for me.

1 Like