I'm trying to make a salesman who will buy all the "Goblets" in your inventory but I'm getting the error attempt to get length of upvalue 'goblet'(a userdata value)
Heres my script:
local click = script.Parent.ClickDetector
local plrmoney
local goblet
click.MouseClick:Connect(function(player)
goblet = player.Backpack:FindFirstChild("Goblet")
plrmoney = player.Backpack.MONEY
for i = 1,#goblet do
plrmoney.Value = plrmoney.Value + 5
end
end)
my error is
18:41:46.564 - Workspace.Salesman.Script:10: attempt to get length of upvalue 'goblet' (a userdata value)
The script is a server script that is within an npc

1 comment
Is "Goblet" a folder or some sort that holds all the globlets in your inventory?