So I created an NPC shop that gives out weapons if you have enough gold. The problem is that only 4 of the 7 items that are in the shop are an option to buy. The other 3 items are in the script are setup virtually the same way.

If it helps identify an immediate answer without looking at the code, here's a .gif I uploaded using gyazo showing only 4 of the 7 options. https://gyazo.com/f8a02478e10274bab847d8b32afb9c71

I also have an error message I don't understand how to fix which is: 20:35:47.831 - Sound failed to load ReplicatedStorage.ClassicSlingshot.Handle.SlingshotSound : rbxasset://sounds//Rubber band sling shot.wav

The script is located in game.Workspace.NPCShop.Head.Dialog.ShopScript if that helps at all.

Here's the shop code:

local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
	-- Checks to see if the player has a stats object
	local stats = player:FindFirstChild("leaderstats")
	if not stats then return end
	
	-- Checks to see if that stats object has Money
	local money = stats:FindFirstChild("Money")
	if not money then return end
	
	if choice == script.Parent.DialogChoice.ClassicSuperball then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicSuperball:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicSuperball:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
		
	elseif choice == script.Parent.DialogChoice.ClassicSword then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicSword:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicSword:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
	
	elseif choice == script.Parent.DialogChoice.ClassicTimebomb then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicTimebomb:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicTimebomb:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
	
	elseif choice == script.Parent.DialogChoice.ClassicSlingshot then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicSlingshot:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicSlingshot:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
		
	elseif choice == script.Parent.DialogChoice.ClassicPaintballGun then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicPaintballGun:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicPaintballGun:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
	
	elseif choice == script.Parent.DialogChoice.ClassicTrowel then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.ClassicTrowel:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.ClassicTrowel:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
	
	elseif choice == script.Parent.DialogChoice.RocketLauncher then
		if money.Value >= 10 then -- 10 is the amount of money you need to purchase this weapon
			game.ReplicatedStorage.RocketLauncher:Clone().Parent = player.StarterGear
			game.ReplicatedStorage.RocketLauncher:Clone().Parent = player.Backpack
			money.Value = money.Value - 10
		end
	end
end)

1 comment

0

Changed the script to a more recent one as I was trying to fix it. However; I still have the same problems. The changes I made recently only organized the shop so there weren't repeating weapons.