I used this script for my shop gui.
player = script.Parent.Parent.Parent.Parent.Parent
cost = 5
function checkForSword()
found = false
for i, v in pairs(player.Backpack:GetChildren()) do
if v.Name == "Sword" then
found = true
end
end
for i, v in pairs(player.Character:GetChildren()) do
if v.Name == "Sword" then
found = true
end
end
if Found == true then
return true
else
return false
end
end
script.Parent.MouseButton1Click:connect(function()
leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
points = leaderstats:FindFirstChild("Points")
if points then
hasSword = checkForSword()
if points.Value >= cost and hasSword == false then
points.Value = points.Value - cost
sword = game.Lighting.Sword:Clone()
sword.Parent = player.Backpack
end
end
end
end)
Whenever I click the GUI to buy an item, it doesn't take from leaderstats or clone the sword in my backpack. Any help?

4 comments
I answered on old question, delete this question right away before you get caught cloning.
Hex, the older script you gave me is still red underline.
Please do not spam random tags. This question has nothing to so with GUIs, Lighting, nor Loops.
You're incorrect. You use Lighting to clone the sword into your backpack. You use Tools to clone into your backpack. And you use fir i,v in pairs loop many times.