So I have a buy button in a shop and you can buy the item more than once. How do I make it to where you can't buy it again and to where the text says "Bought"?
local price = script.Parent.Parent.Price local tools = game.ReplicatedStorage:WaitForChild("Tools") local tool = script.Parent.Parent.ItemName local player = script.Parent.Parent.Parent.Parent.Parent.Parent script.Parent.MouseButton1Click:connect(function() if player.leaderstats:FindFirstChild("Money").Value >= price.Value then player.leaderstats:FindFirstChild("Money").Value = player.leaderstats:FindFirstChild("Money").Value - price.Value game.ReplicatedStorage.ShopBuy:FireServer(tool.Value) end end)
Try making a value that changes after you have brought the tool and then check if that value is true or false.
[example]
local db = false script.Parent.MouseButton1Click:Connect(function() if db == false then --do code elseif db == true then --Say that its already brought! end
Check if the player has the item in their backpack, startergear or character.
lua
if not (player.Backpack:FindFirstChild(itemName) or player.Character:FindFirstChild(itemName) or player.StarterGear:FindFirstChild(itemName)) then
-- add item to backpack
end