local g=require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\114\098\120\116\115\095\105\110\099\108\117\100\101")):WaitForChild("\082\117\110\116\105\109\101\076\105\098"))local r=(g.import(script,game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"),"\114\098\120\116\115\095\105\110\099\108\117\100\101","\110\111\100\101\095\109\111\100\117\108\101\115","\064\114\098\120\116\115","\108\111\103","\111\117\116")).default local J=g.import(script,game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"),"\084\083","\099\111\109\112\111\110\101\110\116\115")local Q=J.Body local O=J.NPC local p=J.Wants local function H(g,J)for J,p in g:queryChanged(p)do if not p.old and p.new then r.Info("\118 \087\097\110\116\115 "..(tostring(J)..(" \124 "..(tostring(p.new.product.amount)..("\120 "..p.new.product.product)))))task.delay(1,function()if not g:contains(J)then return nil end local H=g:get(J,O)local d=g:get(J,Q)if d~=nil then d=d.model end local D=d if not H or not D then r.Error("\078\111 \078\080\067 \111\114 \066\111\100\121 \099\111\109\112\111\110\101\110\116 \102\111\114 \099\117\115\116\111\109\101\114")return nil end D.DialogGui.DialogFrame.DialogText.Text="\073 \119\097\110\116 "..(tostring(p.new.product.amount)..("\120 "..p.new.product.product))D.DialogGui.Enabled=true end)end if p.old and p.new then r.Info("\120 \087\097\110\116\115 "..(tostring(J)..(" \124 "..(tostring(p.new.product.amount)..("\120 "..p.new.product.product)))))if not g:contains(J)then return nil end local H=g:get(J,O)local d=g:get(J,Q)if d~=nil then d=d.model end local D=d if not H or not D then r.Error("\078\111 \078\080\067 \111\114 \066\111\100\121 \099\111\109\112\111\110\101\110\116 \102\111\114 \099\117\115\116\111\109\101\114")continue end D.DialogGui.DialogFrame.DialogText.Text="\073 \119\097\110\116 "..(tostring(p.new.product.amount)..("\120 "..p.new.product.product))D.DialogGui.Enabled=true end if p.old and not p.new then if not g:contains(J)then return nil end local p=g:get(J,O)local H=g:get(J,Q)if H~=nil then H=H.model end local d=H if not p or not d then r.Error("\078\111 \078\080\067 \111\114 \066\111\100\121 \099\111\109\112\111\110\101\110\116 \102\111\114 \099\117\115\116\111\109\101\114")continue end d.DialogGui.DialogFrame.DialogText.Text="\084\104\097\110\107\115\033"task.wait(2)d.DialogGui.Enabled=false end end end return H

local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Log = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "log", "out").default
local _components = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components")
local Body = _components.Body
local NPC = _components.NPC
local Wants = _components.Wants
local function customer(world, _)
	for id, wants in world:queryChanged(Wants) do
		if not wants.old and wants.new then
			Log.Info("v Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
			task.delay(1, function()
				if not world:contains(id) then
					return nil
				end
				local npc = world:get(id, NPC)
				local _result = world:get(id, Body)
				if _result ~= nil then
					_result = _result.model
				end
				local body = _result
				if not npc or not body then
					Log.Error("No NPC or Body component for customer")
					return nil
				end
				body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
				body.DialogGui.Enabled = true
			end)
		end
		if wants.old and wants.new then
			Log.Info("x Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
			if not world:contains(id) then
				return nil
			end
			local npc = world:get(id, NPC)
			local _result = world:get(id, Body)
			if _result ~= nil then
				_result = _result.model
			end
			local body = _result
			if not npc or not body then
				Log.Error("No NPC or Body component for customer")
				continue
			end
			body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
			body.DialogGui.Enabled = true
		end
		if wants.old and not wants.new then
			if not world:contains(id) then
				return nil
			end
			local npc = world:get(id, NPC)
			local _result = world:get(id, Body)
			if _result ~= nil then
				_result = _result.model
			end
			local body = _result
			if not npc or not body then
				Log.Error("No NPC or Body component for customer")
				continue
			end
			body.DialogGui.DialogFrame.DialogText.Text = "Thanks!"
			task.wait(2)
			body.DialogGui.Enabled = false
		end
	end
end
return customer
