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