local f={}do local C={}function C.Create()local f={}local C=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local c=nil local O=nil function f.fire(f,...)c={...}O=select("\035",...)C:Fire()end function f.connect(Z,f)if not f then error("\099\111\110\110\101\099\116\040\110\105\108\041",2)end return C.Event:connect(function()f(unpack(c,1,O))end)end function f.wait(f)C.Event:wait()assert(c,"\077\105\115\115\105\110\103 \097\114\103 \100\097\116\097\044 \108\105\107\101\108\121 \100\117\101 \116\111 \058\084\119\101\101\110\083\105\122\101\047\080\111\115\105\116\105\111\110 \099\111\114\114\117\112\116\105\110\103 \116\104\114\101\097\100\114\101\102\115\046")return unpack(c,1,O)end return f end f.Signal=C function f.Create(f)return function(C)local c=Instance.new(f)for f,C in pairs(C)do if type(f)=="\110\117\109\098\101\114"then C.Parent=c else c[f]=C end end return c end end local function c()local f=workspace.CurrentCamera local C=f and f.ViewportSize.X or 0 local c=f and f.ViewportSize.Y or 0 if C==0 then return 1024 else if C>c then return C else return c end end end f.ViewSizeX=c local function O()local f=workspace.CurrentCamera local C=f and f.ViewportSize.X or 0 local c=f and f.ViewportSize.Y or 0 if c==0 then return 768 else if C>c then return c else return C end end end f.ViewSizeY=O local function Z(f)if f then local C=f:FindFirstChild("\072\117\109\097\110\111\105\100")if C then return f,C else return Z(f.Parent)end end end f.FindChacterAncestor=Z local function T(f,C,c)local O=c or{}local Z,X,D,V=RayCastIgnoreList(workspace,f,O)if Z then if C and Z.CanCollide==false then table.insert(O,Z)return T(f,C,O)end return Z,X,D,V end return nil,nil end f.Raycast=T local function X(f)local C=ZERO_VECTOR2 if#f>0 then for c=1,#f,1 do C=C+f[c]end C=C/#f end return C end f.AveragePoints=X local function D(f,C)return f+.1>C and f-.1<C end f.FuzzyEquals=D local V=0 UIS.InputBegan:connect(function(f,C)if not C then if f.UserInputType==Enum.UserInputType.Touch or f.UserInputType==Enum.UserInputType.MouseButton1 or f.UserInputType==Enum.UserInputType.MouseButton2 then V=tick()end end end)f.GetLastInput=function()return V end end local C={}local function c(f)local c=f and f.Character if c then local O=C[f]if O and O.Parent==c then return O else C[f]=nil local O=c:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if O then C[f]=O end return O end end end

local Utility = {}
do
	local Signal = {}
	function Signal.Create()
		local sig = {}

		local mSignaler = Instance.new('BindableEvent')

		local mArgData = nil
		local mArgDataCount = nil

		function sig:fire(...)
			mArgData = {...}
			mArgDataCount = select('#', ...)
			mSignaler:Fire()
		end

		function sig:connect(f)
			if not f then error("connect(nil)", 2) end
			return mSignaler.Event:connect(function()
				f(unpack(mArgData, 1, mArgDataCount))
			end)
		end

		function sig:wait()
			mSignaler.Event:wait()
			assert(mArgData, "Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
			return unpack(mArgData, 1, mArgDataCount)
		end

		return sig
	end
	Utility.Signal = Signal

	function Utility.Create(instanceType)
		return function(data)
			local obj = Instance.new(instanceType)
			for k, v in pairs(data) do
				if type(k) == 'number' then
					v.Parent = obj
				else
					obj[k] = v
				end
			end
			return obj
		end
	end

	local function ViewSizeX()
		local camera = workspace.CurrentCamera
		local x = camera and camera.ViewportSize.X or 0
		local y = camera and camera.ViewportSize.Y or 0
		if x == 0 then
			return 1024
		else
			if x > y then
				return x
			else
				return y
			end
		end
	end
	Utility.ViewSizeX = ViewSizeX

	local function ViewSizeY()
		local camera = workspace.CurrentCamera
		local x = camera and camera.ViewportSize.X or 0
		local y = camera and camera.ViewportSize.Y or 0
		if y == 0 then
			return 768
		else
			if x > y then
				return y
			else
				return x
			end
		end
	end
	Utility.ViewSizeY = ViewSizeY

	local function FindChacterAncestor(part)
		if part then
			local humanoid = part:FindFirstChild("Humanoid")
			if humanoid then
				return part, humanoid
			else
				return FindChacterAncestor(part.Parent)
			end
		end
	end
	Utility.FindChacterAncestor = FindChacterAncestor

	local function Raycast(ray, ignoreNonCollidable, ignoreList)
		local ignoreList = ignoreList or {}
		local hitPart, hitPos, hitNorm, hitMat = RayCastIgnoreList(workspace, ray, ignoreList)
		if hitPart then
			if ignoreNonCollidable and hitPart.CanCollide == false then
				table.insert(ignoreList, hitPart)
				return Raycast(ray, ignoreNonCollidable, ignoreList)
			end
			return hitPart, hitPos, hitNorm, hitMat
		end
		return nil, nil
	end
	Utility.Raycast = Raycast
	
	local function AveragePoints(positions)
		local avgPos = ZERO_VECTOR2
		if #positions > 0 then
			for i = 1, #positions do
				avgPos = avgPos + positions[i]
			end
			avgPos = avgPos / #positions
		end
		return avgPos
	end
	Utility.AveragePoints = AveragePoints

	local function FuzzyEquals(numa, numb)
		return numa + 0.1 > numb and numa - 0.1 < numb
	end
	Utility.FuzzyEquals = FuzzyEquals

	local LastInput = 0
	UIS.InputBegan:connect(function(inputObject, wasSunk)
		if not wasSunk then
			if inputObject.UserInputType == Enum.UserInputType.Touch or
					inputObject.UserInputType == Enum.UserInputType.MouseButton1 or
					inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
				LastInput = tick()
			end
		end
	end)
	Utility.GetLastInput = function()
		return LastInput
	end
end

local humanoidCache = {}
local function findPlayerHumanoid(player)
	local character = player and player.Character
	if character then
		local resultHumanoid = humanoidCache[player]
		if resultHumanoid and resultHumanoid.Parent == character then
			return resultHumanoid
		else
			humanoidCache[player] = nil -- Bust Old Cache
			local humanoid = character:FindFirstChildOfClass("Humanoid")
			if humanoid then
				humanoidCache[player] = humanoid
			end
			return humanoid
		end
	end
end
