I'm making a shop, basically, when a player buys a gear, it doesn't subtract the one value, instead, it subtracts all the values for the second one and more.
purchaseItem.OnServerEvent:connect(function(plr,msg)
local newTable = bigCopy(plr)
local MasterData = DataStore2(currentData, plr)
if msg == "Starter" then
if newTable.Coins >= itemprices.StarterSword.Value then
newTable.Coins = newTable.Coins - itemprices.StarterSword.Value
-- newTable.Starter = true
-- ItemPrice is 10
end
end
if msg == "Iron" then
if newTable.Coins >= itemprices.IronSword.Value then
newTable.Coins = newTable.Coins - itemprices.IronSword.Value
-- newTable.IronSword = true
-- ItemPrice is 100
end
end
MasterData:Set(newTable)
end)
If you are wondering what "if msg == "Starter" then, when a player clicks a gui button, it fires an event and the event being fired looks like "purchaseRemote:FireServer("gearname")
If you have any questions, please feel free to comment

3 comments
So what exactly does the "msg" value do?
Basically, when the player clicks the Buy button for that gear, it sends a remote event to the server of the name of the gear. Once the event is sent for the message "Iron" it adds the value before it to it so instead of subtracting 100, it subtracts 110
If you are using datastore2 by Kampfkarren, you are not doing it correctly. Please watch tutorial. If datatstore2 is your own module, please provide code for it and bigCopy as well