Ok, so the so it does only allow you to buy the tool once the it says "bought". But then you go to another tool it still says "bought" and not "buy" and you're not able to buy it. So how do I make it to where it says buy for tools that aren't bought. Here the button script.
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 local db = false script.Parent.MouseButton1Click:connect(function() if db == false then 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) db = true script.Parent.Text = "Bought" elseif not (player.Backpack:FindFirstChild(tool.Value) or player.Character:FindFirstChild(tool.Value) or player.StarterGear:FindFirstChild(tool.Value)) then script.Parent.Text = "Buy" 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) db = true end end end end)
I don't understand if you are trying to prompt a purchase or something, which I don't think you are due to you already taking the cash before they even get a prompt (The event might be prompting a purchase if I had to guess.) Regardless, the text should always stay as "Buy" unless the player has the tool or bought it already in which case it would always stay bought.
--assuming all of this is a localscript, which it should be.-- --If they don't have enough cash then this does absolutely nothing.-- --Basically checks if player has weapon. If they don't, it checks cash. If they don't have enough, it does nothing. --If they already have the weapon, the text changes to bought. If they don't, then have enough cash, the text changes to bought. repeat wait() until game.Players.LocalPlayer.Character ~= nil --not always needed but helps to ensure the script does not load before the player, if it does --then it will not run properly local price = script.Parent.Parent.Price local tools = game.ReplicatedStorage:WaitForChild("Tools") local tool = script.Parent.Parent.ItemName local player = game.Players.LocalPlayer -- this is much more efficient and ensures you won't make a mistake local db = false script.Parent.MouseButton1Click:connect(function() if db == false then --it's probably a lot safer to check this first, in fact I don't know why you weren't since it seems you want to check if they have the tool or not if (player.Backpack:FindFirstChild(tool.Value)) ~=nil then script.Parent.Text = "Bought" print('already has')--check if have tool elseif (player.Backpack:FindFirstChild(tool.Value)) == nil and player.leaderstats:FindFirstChild("Money").Value >= price.Value then--check if money is enough player.leaderstats:FindFirstChild("Money").Value = player.leaderstats:FindFirstChild("Money").Value - price.Value game.ReplicatedStorage.ShopBuy:FireServer(tool.Value) db = true end end end)
EDIT:
I re-read that multiple buttons are saying 'Bought.' Did you check the name or value of the tool? If it's the same for all of them, then each button would read that you have the tool that button is supposed to be for.