I Am Working On A Game And I Want To Add Cars And Weapons That You Can Buy With Money From Doing Jobs But I Dont Know How To And I Spent Hours On YT Searching And Its No Help, How Do I Make This Work.
You need to use Developer Products, it’s like gamepasses but the player can buy it multiple times.
This page should explain all you need to know about dev products:
Thanks but I’m wondering about shops to buy cars in within game currency
Ohh, sorry, I completely missunderstood what you were trying to do.
Do you want to know how to create the currency, or how to make the player get things by using the currency?
Make the player get things by using the currency
Okay so, I will write down what you need to do but not really how to do it else this would be quite long, you can ask me how exactly to do something or just google it if you don’t know…
-
You need some form of trigger for each item ofcourse, a UI button or a part the person touches, whatever you choose.
-
When the player triggers it, for example a button, you would send the items name or data to the server using a Remote Event.
-
On the server you would detect the remote event. When it detects it you would check what price the item has (The prices would be stored in a table or folder on the server, you should never pass the price from local).
-
Then, if they have enough of it, you need to remove the player’s currency, and give them the item. The way you give the item would depend on what type of item you are selling and how you made them function. If it is a weapon for example, you would for simply add your weapon to the player’s inventory once you remove the currency. Remove the currency using
player.leaderstats.yourcurrency= player.leaderstats.yourcurrency- price
-
After that you may want to save the player’s data to a DataStore, both the player’s owned items and their amount of currency left. But you can also do this once they leave, it depends. You would save the items by saving a table containing each of the player’s owned items and alternatively the amount of the item, for example:
itemData = {["Gun"] = 1, ["Banana"] = 5}
-
Next time the player joins you would load the player’s item data. If the data contains that weapon for example you would load it into the player’s inventory when the player joins.
I hope this helped!