I made a weapon shop, however whenever i try to buy a different item it always just buys the first one again.
heres my code
local camera = game.Workspace.Camera
local cam = game.StarterGui.Shop1.Cam
local cam1 = game.Workspace.Shop1.ShopCam1
local cam2 = game.Workspace.Shop1.ShopCam2
local cam3 = game.Workspace.Shop1.ShopCam3
local cam4 = game.Workspace.Shop1.ShopCam4
local cam5 = game.Workspace.Shop1.ShopCam5
local cam6 = game.Workspace.Shop1.ShopCam6
function leftClick()
if game.StarterGui.Shop1.Cam.Value == 1 then
if script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value >= 10 then
script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value = script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value - 10
game.Lighting.KnifeTools["Wooden Knife"]:Clone().Parent = script.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.TextButtonBuy.Text = "Buy - $10"
script.Parent.Parent.TextBox.Text = "Wooden Knife"
end
else if game.StarterGui.Shop1.Cam.Value == 2 then
if script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value >= 150 then
script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value = script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value - 150
game.Lighting.KnifeTools["Stone Knife"]:Clone().Parent = script.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.TextButtonBuy.Text = "Buy - $150"
script.Parent.Parent.TextBox.Text = "Stone Knife"
end
else if game.StarterGui.Shop1.Cam.Value == 3 then
if script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value >= 500 then
script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value = script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value - 500
game.Lighting.KnifeTools["Metal Knife"]:Clone().Parent = script.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.TextButtonBuy.Text = "Buy - $500"
script.Parent.Parent.TextBox.Text = "Metal Knife"
end
else if game.StarterGui.Shop1.Cam.Value == 4 then
if script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value >= 2500 then
script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value = script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value - 2500
game.Lighting.KnifeTools["Stainless Steel Knife"]:Clone().Parent = script.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.TextButtonBuy.Text = "Buy - $2,500"
script.Parent.Parent.TextBox.Text = "Stainless Steel Knife"
end
else if game.StarterGui.Shop1.Cam.Value == 5 then
if script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value >= 10000 then
script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value = script.Parent.Parent.Parent.Parent.leaderstats.Cash.Value - 10000
game.Lighting.KnifeTools["Golden Plated Knife"]:Clone().Parent = script.Parent.Parent.Parent.Parent.Backpack
script.Parent.Parent.TextButtonBuy.Text = "Buy - $10,000"
end
end script.Parent.Parent.TextBox.Text = "Golden Plated Knife"
end
end
end
end
end
script.Parent.MouseButton1Click:Connect(leftClick)
im confused why this doesnt work because no matter which one I try and buy it always gives me the wooden knife. The cams are there because im moving the camera to a different spot in the workspace to look at the weapons.

3 comments
This code is terribly cluttered, try using variables instead?
Also, game.StarterGui is just a photocopy machine that hands out pamphlets for the players in the game.
The reason you can't purchase anything else is because cam.Value never changes, because it's inside StarterGui