This script is currently allowing the player to spam more then one item in there inventory which can be used for abuse.
It also allows the player to keep the item when they die and respawn, how do i make this script were it only allows the player to get one item and when they die they loose the item? Thanks for helping!
you=script.Parent.Parent.Parent.Parent.Parent
script.Parent.Text=tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value)
script.Parent.MouseButton1Click:connect(function()
if you:findFirstChild("leaderstats") then
if you.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=you.Backpack
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=you.StarterGear
script.Parent.Selected=false
wait(2)
script.Parent.Selected=true
end
end
end)

5 comments
What is "you" defined as? Also, you shouldn't use Lighting as storage.
http://robloxdev.com/articles/Writing-Clean-Code
You is basically player,
And why are you getting you via 500 script.Parents?
im guessing because there is more them one item buttons in a frame so i have to put parents. when i put Localplayer the script breaks.