I’m currently making a game that involves player customized warrior NPC’s, I want the player to be able to customize these npc’s but I don’t know the best way to setup a ‘system’ where I can have a folder of items in replicated storage and if the player owns and has a certain item equipped it will add that to their warrior’s as their spawned. Currently I have Booleans for every item at the start of the game.
A for loop will get everything in a folder from replicated storage and setup bools in the player for each item, then those are collected when creating a warrior and added based on which ones are true. The shop just sets bools to true.
Each item has a folder called info with a bunch of info like the body part the item attaches to, the offset from that part, health buffs and damage buffs, and harder to explain variable I added to fix problems that arose trying to workout the system. Is there a better way to setup a system like this??
3 Likes
Use a table to set up items owned and items equipped, this prevents the use of unnecessary booleans and makes data stores easier.
Here is an example:
playerdata = {Equipped = {Back = {}, Head = {}, --[[ You get the point]]}, Owned = {Back = {}, Head = {}, --[[ You get the point]]}
2 Likes
How would I access this table from other scripts using a playerId?
1 Like
Nvm I used a module script that has a table of all player’s tables and it has functions built in to modify that data. Everything seems to be working thank you so much!
2 Likes
A module script is a good idea, I use remotes personally
1 Like