buy=script.Parent
wep=game.ServerStorage["AK-47"]
price=script.Parent.IntValue.Value
buy.MouseButton1Down:connect(function()
local user=game.Players.LocalPlayer
if user.leaderstats.Caps.Value>=price then
user.leaderstats.Caps.Value=user.leaderstats.Caps.Value-price
local wepa=wep:Clone()
wepa.Parent=user.Backpack
end
end)
There is a tool in serverstorage named AK-47. The localscript is nested in the text button. There is an IntValue in the TextButton. Caps is an IntValue.
Hope this helps.

3 comments
Insert it in a local script !
It is a localscript
I think that ServerStorage may be the problem. Try inserting the AK-47 into Lighting, and doing it from there.