I've tried this but it didn't work. Please don't judge me, I'm new to scripting.
stats = script.Parent.Parent.Parent.Parent.Parent:findFirstChild("leaderstats")
gold = stats:findFirstChild("Gold")
bp = script.Parent.Parent.Parent.Parent.Backpack
sg = script.Parent.Parent.Parent.Parent.StarterGear
tool = game.Lighting.BowAndArrow
function onClicked(GUI)
if gold.Value < 100 or gold.Value == 100 then
gold.Value = gold.Value - 100
tool:clone().Parent = bp
tool:clone().Parent = sg
end
end
script.Parent.MouseButtn1Click:connect(onClicked) |