So I made a shop Gui and whenever you buy an item it changes the text from "Buy!" to purchased. I made the script so that when ever you buy an item it changes the IntValue called Purchase to 1(Meaning they bought it).
local price = script.Parent.Parent.Price
local tools = game.ReplicatedStorage:WaitForChild("Tools")
local tool = tools:FindFirstChild(script.Parent.Parent.ItemNameValue.Value)
local player = game.Players.LocalPlayer
local cash = player.leaderstats:WaitForChild("Cash")
local Purchased1 = script.Parent.Parent.Parent.Frame.Item1.Purchased
local Purchased2 = script.Parent.Parent.Parent.Frame.Item2.Purchased
local Purchased3 = script.Parent.Parent.Parent.Frame.Item3.Purchased
if script.Parent.Parent.Purchased.Value == 0 then
print("=0")
if script.Parent.Parent.Purchased.Value == 1 then
print("script")
end
end
script.Parent.MouseButton1Click:Connect(function()
if cash.Value >= price.Value then
cash.Value = cash.Value - price.Value
end
if price.Value == 100 then
local oldGun = player.Backpack:FindFirstChildOfClass("Tool") or player.Character:FindFirstChildOfClass("Tool")
oldGun:Destroy()
game.ReplicatedStorage.Tools.Pistol:Clone().Parent = player.Backpack
Purchased1.Value = 1
end
if price.Value == 300 then
local oldGun = player.Backpack:FindFirstChildOfClass("Tool") or player.Character:FindFirstChildOfClass("Tool")
oldGun:Destroy()
game.ReplicatedStorage.Tools.Revolver:Clone().Parent = player.Backpack
Purchased2.Value = 1
end
if price.Value == 500 then
local oldGun = player.Backpack:FindFirstChildOfClass("Tool") or player.Character:FindFirstChildOfClass("Tool")
oldGun:Destroy()
game.ReplicatedStorage.Tools.Uzi:Clone().Parent = player.Backpack
Purchased3.Value = 1
end
end)
My problem is that when the intvalue == 1 it doesnt print("BYU")

2 comments
okthx
If it works accept the answer so we know it's done