So im making a combat game similar to Zo but with a few differences. First off players have all 4 weapons available to them as tools at all times. Players get “Credits” from kills and can spend them on weapon skins in a shop.
INTRODUCTION TO THE SHOP LAYOUT
Here is the shop layout with empty templates-
As you can see there’s a tab for each weapon type (ignore characters). So let me explain the layout of a shop template-
There’s 4 major parts to a shop template:
⁃ The skin price (ShopTemplate.SkinPrice)
⁃ The weapon type (ShopTemplate.WeaponType)
⁃ The skin name (ShopTemplate.Name)
⁃ The skin image (ShopTemplate.Image)
BASIS OF HOW THIS MIGHT WORK PT. 1
So all the weapon skins that will appear in this shop are in a modulescript called ArmoryModule
local module ArmoryModule = {
[“Fire Sword”] = { Name = “Fire Sword”;
Type = “Sword”;
ImageId = 12345678;
PurchasePrice = 1234;
WeaponModel = Game.ReplicatedStorage.WeaponModels.FireSword; };
[“Energy Axe”] = {
Name = “Energy Axe”;
Type = “Axe”;
ImageId = 382829374839;
PurchasePrice = 69420;
WeaponModel = Game.ReplicatedStorage.WeaponModels.EnergyAxe;
};
*The module would continue on past here, this is just a few examples of skin tables*
}
Outside of this module the physical weapon skin models are in a folder in replicated storage called WeaponModels, which is referenced in each table’s WeaponModel variable.
BASIS OF HOW THIS MIGHT WORK PT 2
So how do we get these skins to show up in the shop you may ask? Well here’s the approach I was thinking. For this example let’s use the Sword skin tab of the armory shop.
First, we’d insert a script into the sword shop tab
Second, we could run an in pairs loop to cycle through the ArmoryModule for any tables with their Type equaling sword (Type = Sword). When it finds these tables (let’s use v as a placeholder for these tables) it’ll clone a template shop slot for the item and fill out it’s info using the table and parent it to the shop tab-
(image of a template)
Third, it will set the cloned template’s info to the table’s info like this-
ShopTemplate.SkinPrice = v.PurchasePrice
ShopTemplate.WeaponType = v.Type
ShopTemplate.Name.Text = v.Name
ShopTemplate.Image = v.ImageId
Fourth, RESULT, your templates should now look like this (example)
PURCHASING PT.1
So I’m going to give a brief rundown how the basis of how the purchase system will work since I still need some help on making the system code itself.
So when a player wants to purchase a skin they’ll hold it down and this grey bar will slowly fill over the course of 5 seconds-
So when that bar gets full the system will attempt a purchase. It’ll check if a player’s Credits (our currency) value is greater than or equal to the Template.SkinPrice and if it’s not already in their inventory. If it is then it’ll subtract the Template.SkinPrice value from their currency value. After that it somehow needs to take the table it was created from and insert that table into an InventoryTable (ONE OF THE THINGS I NEED HELP FIGURING OUT), which is our next topic.
PURCHASING PT.2
Now, we know how we want it to work, but we have a few problems to solve-
Problem 1:
So we addressed earlier how the shop system works. It loops through the modulescripts, clones a template, and changes the template info based off the tables. So when a player buys a skin it needs to somehow figure out what table was used to create it and insert it into an inventory table. So let’s say we had a Fire Sword skin in the shop. When a player buys this we want it to find the table used to create that template, then insert that table into our InventoryTable. So when a player buys the Fire Sword skin it needs to somehow go into the modulescript and find the table called Fire Sword, then insert that table into our inventory table.
Problem 2:
We don’t want players buying duplicates of skins, so what’s the best way to check if a player already has a skin in their inventory so they can’t purchase it again?
INVENTORY SYSTEM PT.1
Here’s the inventory layout with some blank templates-
Much like our armory shop there’s tabs for every tool. Ignore the big side bar to the right and the search bar for now.
So let me explain the layout of an inventory template-
There’s 3 major parts to an Inventory template:
⁃ The weapon type (InventoryTemplate.WeaponType)
⁃ The skin name (InventoryTemplate.Name)
⁃ The skin image (InventoryTemplate.Image)
BASIS OF HOW THIS MIGHT WORK PT. 1b
So earlier with our shop we established that when a player buys a skin it’ll insert its table into a big InventoryTable, so it would look something like this-
InventoryTable = {the tables of skins we’ve purchased would be here}
BASIS OF HOW THIS MIGHT WORK PT. 2b
So, the system for the inventory is similar to the shop. For this example let’s use the Sword tab of the inventory.
First, we’d insert a script into the sword tab of the inventory.
Second, we could run an in pairs loop to cycle through the InventoryTable for any tables with their Type equaling sword (Type = Sword). When it finds these tables (let’s use v as a placeholder for these tables) it’ll clone a template inventory slot for the item and fill out it’s info using the table and parent it to the sword inventory tab-
(Image of an inventory template)
Third, it will set the cloned template’s info to the table’s info like this-
InventoryTemplate.WeaponType = v.Type
InventoryTemplate.Name.Text = v.Name
InventoryTemplate.Image = v.ImageId
Fourth, RESULT, your templates should now look like this (example)
EQUIPPING SKINS PT.1
So we’ve established that everyone all has the same 4 weapons and that they’re tools. So let’s go over what we want to ultimately accomplish-
What we want to accomplish:
When a player presses on a slot in the inventory it’ll take that skin, clone it, parent it to the player’s tool, destroy the old tool model, and weld the new one. We also want the equipped skin to be saved when a player leaves & rejoins, or when a player respawns.
Now that we’ve established what we want to achieve let’s address a few problems-
PROBLEM 1:
How will a player actually equip a skin? Our script doesn’t know what model to clone. We need to somehow reference the table used to make that inventory template and its WeaponModel variable. One way I was thinking is when we’re cloning the inventory templates and giving it our table info we somehow give it our WeaponModel Variable info. Here’s an example
InventoryTemplate.WeaponModel = v.WeaponModel
Our tables have a WeaponModel variable which I mentioned earlier, this variable directly gives the location of the model, for example WeaponModel = game.Workspace.ReplicatedStorage.WeaponsFolder..
So basically what we’re doing is taking the table’s weapon model variable and setting a template’s variable to that. So when a player clicks equip it’ll clone the InventoryTemplate’s WeaponModel variable, which is the model we want.
PROBLEM 2:
How will our script know what tool to parent it to? I have an idea for a solution, an if statement. So when a player clicks equip it’ll run an if statement checking the weapon type of a skin, here’s the example-
if InventoryTemplate.WeaponType = Sword then
WeaponModel:Clone()
Clone.Parent = (Our Sword Tool)
(All the code here for the welding, destroying, etc for the skin model)
elseif InventoryTemplate.WeaponType = Axe then
WeaponModel:Clone()
Clone.Parent = (Our Axe Tool)
(All the code here for the welding, destroying, etc for the skin model)
elseif InventoryTemplate.WeaponType = Spear then
WeaponModel:Clone()
Clone.Parent = (Our Spear Tool)
(All the code here for the welding, destroying, etc for the skin model)
elseif InventoryTemplate.WeaponType = Hammer then
WeaponModel:Clone()
Clone.Parent = (Our Hammer Tool)
(All the code here for the welding, destroying, etc for the skin model)
end
Also when it comes to equipping we need it to destroy the old model for the tool/weapon, how would we go about this?
PROBLEM 3:
So we established how the equipping system should work, but how do we only have it change the model for just that player? The weapons are in StarterPack so everyone will receive them on join/respawn. But since everyone gets them, that would mean if we changed the weapon’s model then it would do the same for everyone else right? What’s a good solution to only changing the model for the player and not everyone else?
PROBLEM 4:
Now I don’t know if this will be an issue but I’m making a prediction. If a player dies will the tool’s models reset to the default model? If so, what’s a solution?
PROBLEM 5:
So in our inventory ui when a player equips a skin it’ll change the border color and put a checkmark (checkmark asset isn’t available rn) over it-

How would we do this in particular? I have no idea on how to approach this. We also want this to show up as equipped (border color change and checkmark) when a player rejoins, so how do we save that?
PROBLEM 6:
We want player’s equipped skins to save and load when they leave/rejoin a game right? What’s a good way to have their equipped skins save and be applied when they join a game?
PROBLEM 7:
How do we load newly purchased skins in the inventory? Like say someone has purchased a skin while ingame, how will we update the inventory gui to show it?
Hopefully this helps explain everything in full detail, before we go over the problems feel free to ask any questions or concerns you may have!