local RS = game:GetService("ReplicatedStorage")
local BuyItem = RS.Events.BuyItem
local ServerStorage = game:GetService("ServerStorage")
--Shop Items--
local ClassicSword = ServerStorage.Items:WaitForChild("ClassicSword")
--In a Table--
local shopItems = {
[ClassicSword] = {
Price = 500,
},
}
BuyItem.OnServerEvent:Connect(function(player,item)
--vars
local backpack = player:WaitForChild("Backpack")
--checking for item
if shopItems[item] and backpack then
ServerStorage.Items[shopItems[item]]:Clone().Parent = backpack
player.Money.Value = player.Money.Value -0
print("Purchased Item!")
else
print("Purchase failed!")
end
end)
So I am trying to use a table to secure my remotes a little bit more and it's a lot more organized. Anyways, the problem I am having is I'm getting an error. I get "Purchase Failed" The ClassicSword is clearly in the table... why am I getting purchase failed?

1 comment
Put ClassicSword into " quotes or remove the [] brackets around it