Help with Handling Enemy Lootdrops on the Server vs Client

Hello everyone,

I am trying to brainstorm a way on how to handle enemy lootdrops for my RPG game. I have an idea how exactly how I want it to function but I can’t seem to pan out any ideas on how to achieve this. I have tried searching but there was no information that caters to my needs.

So what I want from this system is:

  1. Once the enemy is killed it will drop a bag with a randomized rarity (Legendary, Epic, Rare)
  2. Inside the bag will choose a random number of items from the rarity
  3. The bags will be client-sided so all players can have varied rarities, and they will have unique lootdrops from one another
  4. A way to store data for the weapons (Rarity, Damage, etc…)

I just need help with figuring out which scripts have to be client sided, which ones have to be handled on the server, and overall how I could possibly utilize module scripts in order to help organize and make the addition of any new items easy.

As I am relatively new to the ROBLOX API, any response would be very helpful to me. Thank you for your time.

I probably won’t be able to help with modules as I am not really familiar with them. However, I can try to help you with the different managers.

For the lootpart, I guess your Weapons Script is on the server. So when killed, it would be on the server (by adding some lines to your Weapons Script).
I think the rarety can be handled by the server as well. Just after the Kill Part in your Weapons Script, you can add a function call to generate a Loot, cloning a bag object with components (ClickDetector, etc) with a rarety randomly generated (just after the cloning part) and assigned as a StringValue in the bag object.

After, when a player would interact with the bag, delete it (still on the server) and send a Client Event to the player. The weapon would be randomly generated on the client once the server fires this event.

With this, the rarety of the bag is still the same for everyone (if we say that each rarety means a different bag color, having a different for each player would be weird in my opinion), but the weapon is hidden to everyone besides the player who interacted with the Loot, making it possible to be handled on the client.

Thank you so much for the response. This definitely opened some options for me as I was having trouble to pick out which events would be handled on the client or the server. I’ll use this and get back to you once I try this out! Thanks again

1 Like

I am happy I could help.

I can’t help you for the Modules and Datastore part. I recommend you to check out tutorials videos which are very useful in general. Here is some links that can be indeed found on Google but yeah.
Modules #1
Modules #2
Datastores #1
Datastores #2