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(R,j,h)return math.max(math.min(h,R),j)end function Functions.GetPercentage(R,j,h)return((h-R)/(j-R))*100 end function Functions.Round(R,j)local h,q=math.modf(R)return q>=j and math.ceil(R)or q<j and math.floor(R)end function Functions.CheckTableForInstance(R,j)for R,h in pairs(R)do if h==j then return true end end return false end function Functions.CheckTableForString(R,j)for R,h in pairs(R)do if string.lower(h)==string.lower(j)then return true end end return false end function Functions.CheckIntangible(R)local j={"\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 R and R.Parent then if(not R.CanCollide or Functions.CheckTableForString(j,R.Name))and not R.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then return true end end return false end function Functions.CastRay(R,j,h,q,y)local b=type(q)=="\116\097\098\108\101"and q or{q}local P,v,z=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(R,j*h),b)if P and Functions.CheckIntangible(P)then if y then wait()end P,v,z=Functions.CastRay(v+j*.01,j,h-(R-v).magnitude,b,y)end return P,v,z end function Functions.TagHumanoid(R,j)local h=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114";Value=j})Debris:AddItem(h,2)h.Parent=R end function Functions.UntagHumanoid(R)for R,j in pairs(R:GetChildren())do if j:IsA("\079\098\106\101\099\116\086\097\108\117\101")and j.Name=="\099\114\101\097\116\111\114"then j:Destroy()end end end function Functions.IsTeamMate(R,j)return R and(j and(not R.Neutral and(not j.Neutral and R.TeamColor==j.TeamColor)))end return Functions
--Made by Luckymaxer

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
