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 D=K.Utilities local C=D.Services local s=require(K.PlayerScripts.Main:WaitForChild("\080\108\097\121\101\114"))local N={}N.Camera=workspace.CurrentCamera N.HUDPositions={}N.HUD_ENABLED=true function N.UpdateHUDPositions(D)local C=K.HUD:GetChildren()for D=1,#C,1 do local s=C[D]if s:IsA("\071\117\105\079\098\106\101\099\116")then N.HUDPositions[s]={}N.HUDPositions[s].Show=s.Position local D={X=0,Y=0}local C={}for D in pairs(D)do C[D]={Offset=0;Scale=0}if s.Position[D].Scale<=.25 then C[D].Scale=0 C[D].Offset=-(s.AbsoluteSize.X*2)elseif s.Position[D].Scale>.25 and s.Position[D].Scale<.75 then C[D].Scale=s.Position[D].Scale C[D].Offset=s.Position[D].Offset else C[D].Scale=0 C[D].Offset=K.HUD.AbsoluteSize.X+s.AbsoluteSize.X*2 end end N.HUDPositions[s].Hide=UDim2.new(C.X.Scale,C.X.Offset,C.Y.Scale,C.Y.Offset)end end end N:UpdateHUDPositions();(K.HUD:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(function()if N.HUD_ENABLED then N:UpdateHUDPositions()end end)function N.TweenHUD(C,D)local s=K.HUD:GetChildren()for K=1,#s,1 do local N=s[K]if N:IsA("\071\117\105\079\098\106\101\099\116")then local K=C.HUDPositions[N]if K then N:TweenPosition(D and K.Show or K.Hide,"\079\117\116","\081\117\105\110\116",1,true)end end end end function N.ToggleHUD(D,K)if K then D:SetDefaultCore()else C.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)end D:TweenHUD(K)D.HUD_ENABLED=K end function N.SetDefaultCore(D)K.PlayerGui:SetTopbarTransparency(1)C.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)C.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)C.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health,true)C.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,true)s.Player.CameraMaxZoomDistance=65 end N:SetDefaultCore()return N
-- access point for easily setting render settings such as default lighting properties, camera, etc

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 <= 0.25 then
					hidden[a].Scale = 0
					hidden[a].Offset = -(hud_element.AbsoluteSize.X * 2)
					--hidden_x_scale = -.5
				elseif hud_element.Position[a].Scale > 0.25 and hud_element.Position[a].Scale < 0.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
