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)
You'd only clone the item in 'Backpack'. Cloning them into StarterGear will let them have the item again, as much as how many times it was cloned into backpack. Character dies, they lose everything in backpack. Character respawned, everything in StarterGear will be copied into backpack.
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 --StarterGear removed script.Parent.Selected=false wait(2) script.Parent.Selected=true end end end)