My NPC's won't give items that people want, even when they have the required KOs (1), the script is a LocalScript, the items are inside ReplicatedStorage - Game_Tools - Food, and the NPC is inside the Workspace. The script looks okay, but I'm confused why it won't work. It doesn't even remove 1 KO to give you the item. No errors either.
local function select(p,d)
local ko = p.leaderstats.KOs
if ko.Value >= 1 then
ko.Value = ko.Value - 1
local item = game.ReplicatedStorage.Game_Tools.Food:findFirstChild(d.Name)
local new = item:clone()
new.Parent = p.Backpack
end end
script.Parent.DialogChoiceSelected:connect(select)

4 comments
select() is a core Lua function name, you should probably use a different name and see if it works.
Hi, On line 5 you should say :findFirstChild("d.Name"), that is the proper way to use it..
They're trying to access the Name property of variable d, right? So if you added quotes it wouldn't access the variable.
Changing it to that made no difference?