local k=require((((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\085\116\105\108\105\116\105\101\115")):WaitForChild("\083\101\114\118\105\099\101\115")):WaitForChild("\082\101\102\101\114\101\110\099\101\115"))local u=k.Utilities local B=u.Services local R=require(k.PlayerScripts.Main:WaitForChild("\080\108\097\121\101\114"))local H={}H.Camera=workspace.CurrentCamera H.HUDPositions={}H.HUD_ENABLED=true function H.UpdateHUDPositions(u)local B=k.HUD:GetChildren()for u=1,#B,1 do local R=B[u]if R:IsA("\071\117\105\079\098\106\101\099\116")then H.HUDPositions[R]={}H.HUDPositions[R].Show=R.Position local u={X=0;Y=0}local B={}for u in pairs(u)do B[u]={Offset=0;Scale=0}if R.Position[u].Scale<=.25 then B[u].Scale=0 B[u].Offset=-(R.AbsoluteSize.X*2)elseif R.Position[u].Scale>.25 and R.Position[u].Scale<.75 then B[u].Scale=R.Position[u].Scale B[u].Offset=R.Position[u].Offset else B[u].Scale=0 B[u].Offset=k.HUD.AbsoluteSize.X+R.AbsoluteSize.X*2 end end H.HUDPositions[R].Hide=UDim2.new(B.X.Scale,B.X.Offset,B.Y.Scale,B.Y.Offset)end end end H:UpdateHUDPositions();(k.HUD:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(function()if H.HUD_ENABLED then H:UpdateHUDPositions()end end)function H.TweenHUD(B,u)local R=k.HUD:GetChildren()for k=1,#R,1 do local H=R[k]if H:IsA("\071\117\105\079\098\106\101\099\116")then local k=B.HUDPositions[H]if k then H:TweenPosition(u and k.Show or k.Hide,"\079\117\116","\081\117\105\110\116",1,true)end end end end function H.ToggleHUD(u,k)if k then u:SetDefaultCore()else B.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)end u:TweenHUD(k)u.HUD_ENABLED=k end function H.SetDefaultCore(u)k.PlayerGui:SetTopbarTransparency(1)B.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)B.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)B.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health,true)B.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,true)R.Player.CameraMaxZoomDistance=65 end H:SetDefaultCore()return H


local References = require(game:GetService("ReplicatedStorage"):WaitForChild("Utilities"):WaitForChild("Services"):WaitForChild("References"))
local Utilities = References.Utilities
local Services = Utilities.Services

local Player = require(References.PlayerScripts.Main:WaitForChild("Player"))

local Gameplay = {}
	Gameplay.Camera = workspace.CurrentCamera
	
	Gameplay.HUDPositions = {}
	Gameplay.HUD_ENABLED = true
		
	function Gameplay:UpdateHUDPositions()
		local hud_elements = References.HUD:GetChildren()
		for i=1,#hud_elements do
			local hud_element = hud_elements[i]
			if hud_element:IsA("GuiObject") then
				Gameplay.HUDPositions[hud_element] = {}
				Gameplay.HUDPositions[hud_element].Show = hud_element.Position
				
				local axis = {X=0,Y=0}
				
				local hidden = {}
				for a in pairs(axis) do
					hidden[a] = {Offset = 0; Scale = 0;};
					if hud_element.Position[a].Scale <= .25 then
						hidden[a].Scale = 0;
						hidden[a].Offset = -(hud_element.AbsoluteSize.X*2)
						--hidden_x_scale = -.5
					elseif hud_element.Position[a].Scale > .25 and hud_element.Position[a].Scale < .75 then
						hidden[a].Scale = hud_element.Position[a].Scale
						hidden[a].Offset = hud_element.Position[a].Offset
					--	hidden_x_scale = hud_element.Position[a].Scale
					else
						hidden[a].Scale = 0;
						hidden[a].Offset = References.HUD.AbsoluteSize.X + (hud_element.AbsoluteSize.X*2)
						--hidden_x_scale = 1.5
					end
				end
				
				
				Gameplay.HUDPositions[hud_element].Hide = UDim2.new(hidden.X.Scale,hidden.X.Offset,hidden.Y.Scale,hidden.Y.Offset)
			end
		end
	end
	Gameplay:UpdateHUDPositions()
	
	References.HUD:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
		if Gameplay.HUD_ENABLED then
			Gameplay:UpdateHUDPositions()
		end
	end)
	
	
	function Gameplay:TweenHUD(on_off)
		local desc = References.HUD:GetChildren()
		for i=1,#desc do
			local d = desc[i]
			if d:IsA("GuiObject") then
				local positions = self.HUDPositions[d]
				if positions then
					d:TweenPosition(on_off and positions.Show or positions.Hide, "Out", "Quint", 1, true)
				end
			end
		end
	end
	
	function Gameplay:ToggleHUD(on_off)
		if on_off then
			self:SetDefaultCore()
		else
			Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
		end
		self:TweenHUD(on_off)
		self.HUD_ENABLED = on_off
	end
	
	-- sets all of our preferred core ui settings (topbar stuff, coreguitypes, etc)
	function Gameplay:SetDefaultCore()
		References.PlayerGui:SetTopbarTransparency(1)
		Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
		Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
		Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true)
		Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
		--Services.StarterGui:SetCore("ResetButtonCallback",false)
		Player.Player.CameraMaxZoomDistance = 65;
	end
	
	Gameplay:SetDefaultCore()

return Gameplay