local p=script.Parent local W=p.BrickColor local S=false local a=p.Parent["\080\108\097\099\101 \084\111\111\108 \105\110 \072\101\114\101\033 \060\060"]local w={}for p,W in pairs(a:GetChildren())do table.insert(w,W:clone())end a:Destroy()local U=p.Parent:FindFirstChild("\066\108\111\099\107")if U~=nil then if U:FindFirstChild("\078\097\109\101\068\105\115\112\108\097\121")then if U.NameDisplay.TextLabel.Text=="\067\117\115\116\111\109 \071\105\118\101\114\033"then if#w>0 then U.NameDisplay.TextLabel.Text=w[1].Name else U.NameDisplay.TextLabel.Text=""end end end end p.Touched:connect(function(a)if S then return end if a==nil then return end if a.Parent==nil then return end local U=game.Players:GetPlayerFromCharacter(a.Parent)if U~=nil then if U:FindFirstChild("\066\097\099\107\112\097\099\107")then local a=true if#allow_team>0 then local p=(game:GetService("\084\101\097\109\115")):GetChildren()if#p>0 then a=false for p,W in pairs(p)do for p,S in pairs(allow_team)do if W.Name==S then if U.TeamColor==W.TeamColor then a=true end end end end end end if not allow_duplicates then for p,W in pairs(w)do if U.Backpack:FindFirstChild(W.Name)then a=false end end end if a then S=true p.BrickColor=BrickColor.new("\066\108\097\099\107")for p,W in pairs(w)do local S=W:clone()S.Parent=U.Backpack end wait(2)p.BrickColor=W S=false end end end end)









local button = script.Parent
local startcolor = button.BrickColor
local DB = false

local toolfolder = button.Parent["Place Tool in Here! <<"]
local toolstorage = {}
for i, tool in pairs(toolfolder:GetChildren()) do
	table.insert(toolstorage, tool:clone())
end
toolfolder:Destroy()

local block = button.Parent:FindFirstChild("Block")
if block ~= nil then
	if block:FindFirstChild("NameDisplay") then
		if block.NameDisplay.TextLabel.Text == "Custom Giver!" then
			if #toolstorage > 0 then
				block.NameDisplay.TextLabel.Text = toolstorage[1].Name
			else
				block.NameDisplay.TextLabel.Text = ""
			end
		end
	end
end


button.Touched:connect(function(hit)
	if DB then return end
	if hit == nil then return end
	if hit.Parent == nil then return end
	
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player ~= nil then
		if player:FindFirstChild("Backpack") then
			local allow = true
			if #allow_team > 0 then
				local teams = game:GetService("Teams"):GetChildren()
				if #teams > 0 then
					allow = false
					for i, team in pairs(teams) do
						for i, allowedteamname in pairs(allow_team) do
							if team.Name == allowedteamname then
								if player.TeamColor == team.TeamColor then
									allow = true
								end
							end
						end
					end
				end
			end
			if not allow_duplicates then
				for i, tool in pairs(toolstorage) do
					if player.Backpack:FindFirstChild(tool.Name) then
						allow = false
					end
				end
			end
			if allow then
				DB = true
				button.BrickColor = BrickColor.new("Black")
				for i, tool in pairs(toolstorage) do
					local newtool = tool:clone()
					newtool.Parent = player.Backpack
				end
				wait(2)
				button.BrickColor = startcolor
				DB = false
			end
		end
	end
end)
