Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to add an in-game store, where in-game items can be purchased with in-game currency?

Asked by 4 years ago

I'm somewhat of a noob and only recently did I learn about GUIs and buttons.

How can I add an in-game store in my game, in which things can be purchased with the in-game money I'm adding into the game?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello!

In order to be able to add an in-game store you need to have an ingame currency (e.g leaderstats currency), with that you also need to be able to have a button in which contains a script that subtracts the amount of ingame currency you would like your item to cost and that once the currency amount is subtracted a way for the script to reward the player (e.g rewarding the player a sword tool from ReplicatedStorage) as a LocalScript.

Here is a quick example following what I have stated above:

local Player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SwordTool = ReplicatedStorage :WaitForChild("ClassicSword")
local Backpack = Player:WaitForChild("Backpack")

script.Parent.MouseButton1Click:Connect(function()
    if Player.leaderstats.Cash.Value >= 50 then -- Change 50 to the amount of cash a player required to have in order to be able to buy this
        SwordTool:Clone().Parent = Backpack
        Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value - 50
    end
end)
0
This makes sense, thank you! What if, in my case, what the person is purchasing isn't an item, but rather another kind of script? stealthmode642 -2 — 4y
0
Hello! I am glad to see that what I have written made sense to you! I am trying to understand, in your case, what do you mean another kind of script? RazzyPlayz 497 — 4y
0
Well my game is essentially the stock market but in ROBLOX, so basically, the in-game store would be where players can purchase new shares for a certain stock. If that makes any sense lol stealthmode642 -2 — 4y
Ad

Answer this question