Ad
Log in to vote
0

How to make a Shop GUI that allows to buy WORKING ITEMS?

Asked by 21 days ago

Hello, I have a scripting question. So I made a frame, which was inside of a screen GUI, inside of Starter GUI. I made textbuttons that when clicked, would check if you have the specific amount of points required, and if you did, it would give you an item/tool. I have followed a tutorial for this on Youtube, and for some reason, it did work and give you the items, but the items/tools didn't work and you were only able to hold them and had no use. For example, a Bloxy Cola. I made it so if you clicked the text button, it would check if you had 10 points, and if you did, it would take them away (just like a shop) and give you the Bloxy Cola. But the issue was, the Bloxy Cola didn't work and wasn't usable, but I knew for a fact that it was supposed to work as I had tried to same item. My tools were placed inside the Lighting. The script also said the item was cloned into the backpack or something. I do not have the script since I deleted it when I realized it didn't help me, but I do have the tutorial that I had followed.

Here was the tutorial I had followed: https://youtu.be/AbEcnOFQ6HI by StudioTutorialzYT

1 answer

Log in to vote
0
Answered by 20 days ago

Hello, Basically make ur gui and make ur items that u can buy and paste this code in each button.

local btn = script.Parent
-- im assuming ur using leaderstats to show the currency
btn.MouseButton1Click:Connect(function()
    -- this is a weird way to get the player but works for me!
    -- this depends on how many frames u got.
    --make sure to keep adding.Parent if it dosent get the player yet
    local plr = script.Parent.Parent.Parent.Parent.Parent
    local itemtobuy = game.ServerStorage.ItemNameHere
    local cost = 100
    if plr.leaderstats.Cash.Value == cost or plr.leaderstats.Cash.Value > cost then
        plr.leaderstats.Cash.Value -= cost
        itemtobuy:Clone().Parent = plr.Backpack
    end
end)

Tell me if it dosent work i might be able to fix some bugs for u

Ad

Answer this question