Functions={}Debris=game:GetService("\068\101\098\114\105\115")RbxUtility=LoadLibrary("\082\098\120\085\116\105\108\105\116\121")Create=RbxUtility.Create function Functions.Clamp(B,K,o)return math.max(math.min(o,B),K)end function Functions.GetPercentage(B,K,o)return((o-B)/(K-B))*100 end function Functions.Round(B,K)local o,U=math.modf(B)return U>=K and math.ceil(B)or U<K and math.floor(B)end function Functions.CheckTableForInstance(B,K)for B,o in pairs(B)do if o==K then return true end end return false end function Functions.CheckTableForString(B,K)for B,o in pairs(B)do if string.lower(o)==string.lower(K)then return true end end return false end function Functions.CheckIntangible(B)local K={"\087\097\116\101\114","\065\114\114\111\119","\080\114\111\106\101\099\116\105\108\101","\069\102\102\101\099\116";"\082\097\105\108";"\076\097\115\101\114","\066\117\108\108\101\116"}if B and B.Parent then if(not B.CanCollide or Functions.CheckTableForString(K,B.Name))and not B.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then return true end end return false end function Functions.CastRay(B,K,o,U,m)local a=type(U)=="\116\097\098\108\101"and U or{U}local H,S,Z=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(B,K*o),a)if H and Functions.CheckIntangible(H)then if m then wait()end H,S,Z=Functions.CastRay(S+K*.01,K,o-(B-S).magnitude,a,m)end return H,S,Z end function Functions.TagHumanoid(B,K)local o=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114",Value=K})Debris:AddItem(o,2)o.Parent=B end function Functions.UntagHumanoid(B)for B,K in pairs(B:GetChildren())do if K:IsA("\079\098\106\101\099\116\086\097\108\117\101")and K.Name=="\099\114\101\097\116\111\114"then K:Destroy()end end end function Functions.IsTeamMate(B,K)return B and(K and(not B.Neutral and(not K.Neutral and B.TeamColor==K.TeamColor)))end return Functions


Functions = {}

Debris = game:GetService("Debris")

RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create

function Functions.Clamp(Number, Min, Max)
	return math.max(math.min(Max, Number), Min)
end

function Functions.GetPercentage(Start, End, Number)
	return (((Number - Start) / (End - Start)) * 100)
end

function Functions.Round(Number, RoundDecimal)
	local WholeNumber, Decimal = math.modf(Number)
	return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end

function Functions.CheckTableForInstance(Table, Instance)
	for i, v in pairs(Table) do
		if v == Instance then
			return true
		end
	end
	return false
end
	
function Functions.CheckTableForString(Table, String)
	for i, v in pairs(Table) do
		if string.lower(v) == string.lower(String) then
			return true
		end
	end
	return false
end
	
function Functions.CheckIntangible(Hit)
	local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
	if Hit and Hit.Parent then
		if ((not Hit.CanCollide or Functions.CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
			return true
		end
	end
	return false
end

function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
	local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
	local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
	if RayHit and Functions.CheckIntangible(RayHit) then
		if DelayIfHit then
			wait()
		end
		RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
	end
	return RayHit, RayPos, RayNormal
end

function Functions.TagHumanoid(humanoid, player)
	local Creator_Tag = Create("ObjectValue"){
		Name = "creator",
		Value = player,
	}
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

function Functions.UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end
	
function Functions.IsTeamMate(Player1, Player2)
	return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end

return Functions
