Best way to store objects like pets?

I have a game with objects similiar to pets and I need to store them for each player. Each “object” is just a dictionary with the properties like

Pet = {
    ID = X,
    OwnerID = X,
    Name = X,
    Rarity = X,
    Damage = X,
    Animal = X
}

There are 2 ways I can think to store them, which should I pick ? If either of them?

  1. Store a folder called PetInventory for each player that joins the game
    add a folder into the player for each pet and put it in petinventory and then create the properties
    so number value for Damage, String Value for Animal and rarity, int value for ID etc etc

  2. Store an array on the server
    Add the pet’s of everyone into the array
    to get a specific person’s bet just loop through the array picking out the one’s who’s ownerid matches the plr.UserId and send the info back to the client.

Advantages of the first option are that the inventory system will be more responsive as you can access some information from the client

Advantages of the second option are that it’s much safer and impossible to hack
although there is a slight delay when equipping a pet and searching through the inventory as it has to get all the info from the server which takes at least 0.5 seconds giving very slight, but noticable delay

2 Likes

use a folder in the workspace, and name it to “Pets”, or whatever you like, and add the players name before the pet name, like:
AidenDog or BeeCat, where Aiden and Bee are the player’s names.

but then everyone can see anyone elses inventory through exploiting
so you’re suggesting using folders but not for each player, instead just a global one for the server

store it on serverside, or even in lighing or terrain?

on serverside, on any game, even outside of roblox, its harder to hack.

if you store something on server side in the workspace all clients can see it and all it’s children

oh

char limit

i would go with the second option, its impossible to hack, and the delay is worth it to make it impossible to hack. and delays exist on adopt me as well

1 Like

Have the Data on the Server somewhere Secure like in ServerStorage, and Access it by using RemoteEvents, Perform Sanity Checks to make sure that the Client is accurate to the Server in what it returns, this is ensure that your System is not Exploitable by Anybody, as the Server Cannot be Exploited by anyone, but the Client is, which is why people say to Assume everything on the Client is false.

1 Like

Well, my remote events and remote functions are unhackable, I simply pass a 10 character code and if the first argument recieved on the server side is not equal to that code then return and kick/ban the player.
(The 10 character code is diff for every remote event)
But can’t I just store all the data in an array then rather than physical instances in the server storage?

1 Like

I would say use ModuleScripts, they allow you to keep yourself Organized, and when it is Requested to Give the Player a Pet, Grab the Data, and Apply it to the Corresponding Items.

1 Like

I was hoping if anyone knew how the almighty Pet Simulator X probably does it because that game feels great whilst being truly as close to unhackable as you can get

1 Like

yeah, so an array in a server side accessible module script
then any server script can write to it
^
this would work and is a good idea?

Honestly it really depends on how you want to do it. At the end of the day, both solutions will work. I personally prefer just representing them as tables on the server and have the client request data from the server and then cache it’s own copy for faster future reference with the server sending updates from time to time. But that’s just personal preference.

1 Like

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