local function l()closedGoal={Size=Block.Size;Position=Block.Position}local l=Vector3.new(Block.Size.X,.05,Block.Size.Z)local O=Block.Position+(Block.CFrame.UpVector*Block.Size.Y)*.5 openGoal={Size=l;Position=O}end local function O()for l,O in pairs(ProximityPrompts:GetChildren())do if O:IsA("\079\098\106\101\099\116\086\097\108\117\101")then local l=O.Value if l:IsA("\080\114\111\120\105\109\105\116\121\080\114\111\109\112\116")then table.insert(proximityPrompts,l)end end end end local function h(l)if tween then tween:Destroy()end local O=math.abs((Block.Size.Y-l.Size.Y)/shrinkSpeed)local h=TweenInfo.new(O,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)tween=TweenService:Create(Block,h,l)tween:Play()if isOpen then isOpen=false else isOpen=true end end local function A(l)local O=l.TeamColor local h for l,A in pairs(teamColorObjectValues)do if A.Value==O then h=true end end return h end local function K(l)if not A(l)then return end if isOpen then h(closedGoal)else h(openGoal)end end
-- Functions --
local function setUp()
	closedGoal = { Size = Block.Size, Position = Block.Position }

	local smallSize = Vector3.new(Block.Size.X, 0.05, Block.Size.Z)
	--local smallPosition = Vector3.new((Block.Position.X), (Block.Position.Y - Block.CFrame.UpVector * Block.Size.Y * -0.5), (Block.Position.Z))
	local smallPosition = Block.Position + Block.CFrame.UpVector * Block.Size.Y * 0.5
	openGoal = { Size = smallSize, Position = smallPosition }
end

local function getProximityPrompts()
	for index, child in pairs(ProximityPrompts:GetChildren()) do
		if child:IsA("ObjectValue") then
			local prompt = child.Value
			if prompt:IsA("ProximityPrompt") then
				table.insert(proximityPrompts, prompt)
			end
		end
	end
end

local function tweenTo(goal)
	if tween then
		tween:Destroy()
	end

	local duration = math.abs((Block.Size.Y - goal.Size.Y) / shrinkSpeed)
	local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
	tween = TweenService:Create(Block, tweenInfo, goal)
	tween:Play()
	if isOpen then
		isOpen = false
	else
		isOpen = true
	end
end

local function isOnValidTeam(player)
	local playerTeamColor = player.TeamColor
	local isValid

	for index, objectValue in pairs(teamColorObjectValues) do
		if objectValue.Value == playerTeamColor then
			isValid = true
		end
	end

	return isValid
end

local function onTriggered(player)
	if not isOnValidTeam(player) then
		return
	end
	if isOpen then
		tweenTo(closedGoal)
	else
		tweenTo(openGoal)
	end
end
