This is the code i have right now, the code doesnt work if i click on an item, and i just dont know whats wrong with it
local A = 0
local button = script.Parent
local player = game.Players.LocalPlayer
local leaderboard = player:WaitForChild("leaderstats")
local button = script.Parent
local price = button:WaitForChild("Price")
local item = button:WaitForChild("ItemName")
local rs = game:GetService("ReplicatedStorage")
button.MouseButton1Click:Connect(function()
if a == 1 then
return
end
else
if leaderboard.Coins.Value>=price.Value then
leaderboard.Coins.Value = leaderboard
Coins.Value - price.Value
local item = rs:WaitForChild(item.Value)
item:Clone().Parent = player.StarterGear
item:Clone().Parent = player.Backpack
A = 1
end
end)
while wait()do
button.Text = item.Value.."-"..price.Value
end
end
end)
