So, I’ll give a bit of backstory. I’m making a combat game and players have 4 weapon types (tools). Players get currency from kills and can use that currency to buy skins for their weapons (these skins are actual models). Well with my gui setup I want to display the skin’s name, rarity, imageid, and weapon type. I plan on storing all of these via a module script with a dictionary and tables for every weapon skin’s information. And then I also planned on storing all the models in the game in a folder in server storage.
WHAT IM TRYING TO ACHIEVE:
When a player purchases a skin from the shop it’ll do 3 things. 1, it’ll move the skin to a custom inventory. 2, It’ll read the table info for that skin and then create a new slot in the inventory with all of the info. (There’s specific tabs in the inventory for each weapon type, hence I’m storing the weapon type in the info table) 3, It’ll save the skin model and all its information.
————————————————————-—————-—————-
My idea was when a player presses purchase, it’ll fire a remote event and clone the skin’s info table into an inventory table. But I don’t know how to make it so models are cloned to an inventory folder. I also don’t know how to make it so when a skin is purchased and cloned to the the inventory it’ll create a new template slot, read the table info, and then change the template to reflect that info. This leads to another thing, how would I save the inventory table storing all the table info and save the inventory folder storing all the actual models? Then how would I make all of it load properly and set up in an inventory gui properly when a player loads in?
If anyone can provide insight or help, or point me in the direction of a solution then please do. I am currently developing a game and that’s the main thing I can’t seem to figure out.
Make a folder in ReplicatedStorage for when the player joins and call it “PlayerSkins”, replacing Player with the username or userid. Then you can clone the skin model or name (as a string/object value) into the folder. You can detect this on the gui script with a ChildAdded event.
You mentioned storing the imageid of a skin, using viewports are usually an easier way to do this, as you don’t need to upload an image for each skin.
As for the rest of your concerns I’d probably do something like this:
Store all skins in replicated storage. This allows both the server and client to access them for whatever display needs they have.
The custom inventory players have should be a folder, or maybe even Player.Backpack. This means that once they equip a skin the server can just clone the model into that position and the client will instantly have access to it (and have it replicated).
To save (and load) what they have unlocked etc. you need to use data stores.
I recommend making sure that each skin has something unique to identify it with, preferably the name for ease of access and management. This means that the data store only needs to save the names of the skins that are owned and no actual info of the skins themselves, lowering the storage required.
Yeah I planned on making a modulescript with a dictionary and tables to store everything. Here’s some examples-
[“Fire Sword”] = {
Name = “Fire Sword”;
Weapon Type = “Sword”;
SkinModel = game.RepStorage.WeaponSkins.Fire Sword;
ImageID = “1234561789”
Rarity = “Legendary”;
RarityGlowImageID = “987654321”;
Price = 1234;
};
[“Golden Axe”] = {
Name = “Golden Axe”;
Weapon Type = “Axe”;
Skin Model = game.RepStorage.WeaponSkins.Golden Axe;
ImageID = “1234561789”
Rarity = “Common”;
RarityGlowImageID = “987654321”;
Price = 100;
}; Table of weapons would continue
So when a player presses purchase on a weapon it’ll fire a remote event the clones the info table for that weapon into an inventory table and also clones the weapon model from the skins folder into an inventory folder. Then I want it to detect that a new weapon has been added to the inventory and then clone a template gui box and fill out all the info such as imageid, weapon name, rarity glow, and also put it in the correct tab. Then when a player decides to equip a new skin they have to click that new box in the inventory for that skin. It’ll then fire a remote event to get that weapon skin then clone it to the weapon model, destroy the old model, weld the new model to the tool’s handle, and boom. Then I wanna somehow set it up to save player’s inventory folder and table then load it and the ui when they join a server.
How to Make Server-Synced Daily Shops I also want to somehow hook up this whole system with a weekly shop. Problem is I need to figure out how to do this - When a skin is selected for the shop the game will then read that weapon’s name, check the info table for it, and change the item shop slot to reflect that information. Then when the shop changes it’ll remove it and do the same for the next skin