local function C(C)local Q=plr.Character if not Q then return end local A=Q:FindFirstChildWhichIsA("\084\111\111\108")if not A or not A:FindFirstChild("\072\097\110\100\108\101")then return end local m=string.split(C.ObjectText,"\058 ")local L,Y=m[1],m[2]if not L or not Y then return end m=string.split(Y,"\047")local q,N=m[1],m[2]q=tonumber(q)if A.Name==L then q+=1 local Q=q>=tonumber(N)events.TradeItem:FireServer(C,Q)if Q then C.ObjectText="\070\105\110\105\115\104\101\100\033"else C.ObjectText=L..("\058 "..(tostring(q)..("\047"..N)))end end end NPCs.Seller.UpperTorso.ProximityPrompt.Triggered:Connect(function(C)local Q=C.Character if not Q then return end local A=Q:FindFirstChildWhichIsA("\084\111\111\108")if not A or not A:FindFirstChild("\072\097\110\100\108\101")then return end local m=A.Handle:FindFirstChild("\080\114\105\099\101")if m then A:Destroy()C.Wallet.Value+=m.Value end end)for Q,A in NPCs.Traders:GetChildren()do local m=A.UpperTorso.ProximityPrompt m.Triggered:Connect(function()C(m)end)end

local function trade(PP)
	local char = plr.Character
	if not char then return end
	local tool = char:FindFirstChildWhichIsA("Tool")
	if not tool or not tool:FindFirstChild("Handle") then return end
	local args = string.split(PP.ObjectText, ": ")
	local required, amount = args[1], args[2]
	if not required or not amount then return end
	args = string.split(amount, "/")
	local given,max = args[1], args[2]
	given = tonumber(given)
	if tool.Name == required then
		given +=1
		local final = given >= tonumber(max)
		events.TradeItem:FireServer(PP, final)
		if final then
			PP.ObjectText = "Finished!"
		else
			PP.ObjectText = required .. ": " .. tostring(given) .. "/" .. max
		end
	end
end

NPCs.Seller.UpperTorso.ProximityPrompt.Triggered:Connect(function(plr)
	local char = plr.Character
	if not char then return end
	local tool = char:FindFirstChildWhichIsA("Tool")
	if not tool or not tool:FindFirstChild("Handle") then return end
	local res = tool.Handle:FindFirstChild("Price")
	if res then
		tool:Destroy()
		plr.Wallet.Value += res.Value
	end
end)
for i,trader in NPCs.Traders:GetChildren() do
	local PP = trader.UpperTorso.ProximityPrompt
	PP.Triggered:Connect(function()
		trade(PP)
	end)
end
