Debris=game:GetService("\068\101\098\114\105\115")RbxUtility=LoadLibrary("\082\098\120\085\116\105\108\105\116\121")Create=RbxUtility.Create ProjectileNames={"\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"}Functions={FindCharacterAncestor=function(Z)if Z and Z~=game:GetService("\087\111\114\107\115\112\097\099\101")then local x=Z:FindFirstChild("\072\117\109\097\110\111\105\100")if x then return Z,x else return Functions.FindCharacterAncestor(Z.Parent)end end return nil end,CheckTableForString=function(Z,x)for Z,s in pairs(Z)do if string.lower(s)==string.lower(x)then return true end end return false end,CheckIntangible=function(Z)if Z and Z.Parent then if Functions.CheckTableForString(ProjectileNames,Z.Name)then return true end local x=Z.Parent local s=x.Parent local F=s:FindFirstChild("\072\117\109\097\110\111\105\100")if F and(F.Health>0 and x:IsA("\072\097\116"))then return true end end return false end;CastRay=function(Z,x,s,F,i)local o,L,G=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(Z,x*s),F)if o and Functions.CheckIntangible(o)then if i then wait()end o,L,G=Functions.CastRay(L+x*.01,x,s-(Z-L).magnitude,F,i)end return o,L,G end,IsTeamMate=function(Z,x)return Z and(x and(not Z.Neutral and(not x.Neutral and Z.TeamColor==x.TeamColor)))end,TagHumanoid=function(Z,x)local s=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114",Value=x})Debris:AddItem(s,2)s.Parent=Z end;UntagHumanoid=function(Z)for Z,x in pairs(Z:GetChildren())do if x:IsA("\079\098\106\101\099\116\086\097\108\117\101")and x.Name=="\099\114\101\097\116\111\114"then x:Destroy()end end end;CheckTableForString=function(Z,x)for Z,s in pairs(Z)do if string.lower(s)==string.lower(x)then return true end end return false end;Clamp=function(Z,x,s)return math.max(math.min(s,Z),x)end,GetPercentage=function(Z,x,s)return((s-Z)/(x-Z))*100 end,Round=function(Z,x)local s,F=math.modf(Z)return F>=x and math.ceil(Z)or F<x and math.floor(Z)end}return Functions


Debris = game:GetService("Debris")

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

ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}

Functions = {
	
	FindCharacterAncestor = (function(Object)
		if Object and Object ~= game:GetService("Workspace") then
			local Humanoid = Object:FindFirstChild("Humanoid")
			if Humanoid then
				return Object, Humanoid
			else
				return Functions.FindCharacterAncestor(Object.Parent)
			end
		end
		return nil
	end),

	CheckTableForString = (function(Table, String)
		for i, v in pairs(Table) do
			if string.lower(v) == string.lower(String) then
				return true
			end
		end
		return false
	end),
	
	CheckIntangible = (function(Hit)
		if Hit and Hit.Parent then
			if Functions.CheckTableForString(ProjectileNames, Hit.Name) then
				return true
			end
			local ObjectParent = Hit.Parent
			local Character = ObjectParent.Parent
			local Humanoid = Character:FindFirstChild("Humanoid")
			if Humanoid and Humanoid.Health > 0 and ObjectParent:IsA("Hat") then
				return true
			end
		end
		return false
	end),
	
	CastRay = (function(StartPos, Vec, Length, Ignore, DelayIfHit)
		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),
	
	IsTeamMate = (function(Player1, Player2)
		return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
	end),
	
	TagHumanoid = (function(humanoid, player)
		local Creator_Tag = Create("ObjectValue"){
			Name = "creator",
			Value = player,
		}
		Debris:AddItem(Creator_Tag, 2)
		Creator_Tag.Parent = humanoid
	end),
	
	UntagHumanoid = (function(humanoid)
		for i, v in pairs(humanoid:GetChildren()) do
			if v:IsA("ObjectValue") and v.Name == "creator" then
				v:Destroy()
			end
		end
	end),
	
	CheckTableForString = (function(Table, String)
		for i, v in pairs(Table) do
			if string.lower(v) == string.lower(String) then
				return true
			end
		end
		return false
	end),
	
	Clamp = (function(Number, Min, Max)
		return math.max(math.min(Max, Number), Min)
	end),
	
	GetPercentage = (function(Start, End, Number)
		return (((Number - Start) / (End - Start)) * 100)
	end),
	
	Round = (function(Number, RoundDecimal)
		local WholeNumber, Decimal = math.modf(Number)
		return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
	end),
	
}

return Functions
