Here's my script. When the player Prestige, I also wanted to give them a certain amount of stat on Prestige (in leaderstats), but this don't seem to work, what am I doing wrong?
local items = script.Parent.Frame:GetChildren()
for i = 1, #items do
function buy()
local Cash = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild(items[i].Currency.Value)
local Prestige = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild(items[i].Prestige.Value)
if Cash.Value >= items[i].Cost.Value then
Cash.Value = Cash.Value - items[i].Cost.Value
Prestige.Value = Prestige.Value + items[i].Prestige.Value
local toolca = game.Lighting:FindFirstChild(items[i].ItemName.Value):Clone()
local toolcb = game.Lighting:FindFirstChild(items[i].ItemName.Value):Clone()
toolca.Parent = script.Parent.Parent.Parent.Parent.Backpack
toolcb.Parent = script.Parent.Parent.Parent.Parent.StarterGear
end
end
items[i].BuyButton.MouseButton1Click:connect(buy)
end

2 comments
Please be more specific as what you want the script to do, because i made a buy script once and it was different than this and this i dont understand, ex : when you click a gui it takes away cash from leaderstats, when clicking a brick...
no, when you touch a brick the GUI comes up, and when you click the buy button it takes the money from the leaderstat. It works fine for the item giving part, but it just doesn't +1 to the Prestige stat on the leaderboard.