Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")RbxUtility=LoadLibrary("\082\098\120\085\116\105\108\105\116\121")Create=RbxUtility.Create Functions={}function Functions.TagHumanoid(E,u)local z=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114",Value=u})Debris:AddItem(z,2)z.Parent=E end function Functions.UntagHumanoid(E)for E,u in pairs(E:GetChildren())do if u:IsA("\079\098\106\101\099\116\086\097\108\117\101")and u.Name=="\099\114\101\097\116\111\114"then u:Destroy()end end end function Functions.IsTeamMate(E,u)return E and(u and(not E.Neutral and(not u.Neutral and E.TeamColor==u.TeamColor)))end function Functions.CheckTableForString(E,u)for E,z in pairs(E)do if string.find(string.lower(u),string.lower(z))then return true end end return false end function Functions.CheckIntangible(E)local u={"\076\105\103\104\116\110\105\110\103","\069\102\102\101\099\116","\080\114\111\106\101\099\116\105\108\101","\065\114\114\111\119";"\066\117\108\108\101\116";"\087\097\116\101\114"}if E and E.Parent then local z for E,u in pairs(E.Parent:GetChildren())do if u:IsA("\072\117\109\097\110\111\105\100")then z=u break end end if not z and(not E.CanCollide and E.Transparency>=1 or Functions.CheckTableForString(u,E.Name)or E.Parent:IsA("\072\097\116")or E.Parent:IsA("\084\111\111\108"))then return true end end return false end function Functions.CastRay(E,u,z,o,G)local r=type(o)=="\116\097\098\108\101"and o or{o}local f,v,a=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(E,u*z),r)if f and Functions.CheckIntangible(f)then if G then wait()end f,v,a=Functions.CastRay(v+u*.01,u,z-(E-v).magnitude,r,G)end return f,v,a end function Functions.GetTotalParts(E,u,z)if E<u then return E elseif z>=E then return 0 elseif E>=u then local o=E-u if z<=E then o=E-z if o>u then return u else return o end elseif o>=u then return u else return o end end end function Functions.GetParts(E,u,z)local o={}local G=false while#o<u and not G do local r=E local f=Functions.GetTotalParts(u,100,#o)local v=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartsInRegion3WithIgnoreList(r,z,f)if#v==0 then G=true else for E,u in pairs(v)do table.insert(o,u)table.insert(z,u)end end end return o end function Functions.CheckTableForInstance(E,u)for E,z in pairs(E)do if z==u then return true end end return false end return Functions
--Made by Luckymaxer

Players = game:GetService("Players")
Debris = game:GetService("Debris")

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

Functions = {}

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

function Functions.CheckTableForString(Table, String)
	for i, v in pairs(Table) do
		if string.find(string.lower(String), string.lower(v)) then
			return true
		end
	end
	return false
end

function Functions.CheckIntangible(Hit)
	local ProjectileNames = { "Lightning", "Effect", "Projectile", "Arrow", "Bullet", "Water" }
	if Hit and Hit.Parent then
		local HumanoidFound
		for i, v in pairs(Hit.Parent:GetChildren()) do
			if v:IsA("Humanoid") then
				HumanoidFound = v
				break
			end
		end
		if
			not HumanoidFound
			and (
				(not Hit.CanCollide and Hit.Transparency >= 1)
				or Functions.CheckTableForString(ProjectileNames, Hit.Name)
				or Hit.Parent:IsA("Hat")
				or Hit.Parent:IsA("Tool")
			)
		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.GetTotalParts(MaxParts, PossibleParts, Parts)
	if MaxParts < PossibleParts then
		return MaxParts
	elseif Parts >= MaxParts then
		return 0
	elseif MaxParts >= PossibleParts then
		local PartCount = (MaxParts - PossibleParts)
		if Parts <= MaxParts then
			PartCount = (MaxParts - Parts)
			if PartCount > PossibleParts then
				return PossibleParts
			else
				return PartCount
			end
		elseif PartCount >= PossibleParts then
			return PossibleParts
		else
			return PartCount
		end
	end
end

function Functions.GetParts(Region, MaxParts, Ignore)
	local Parts = {}
	local RerunFailed = false
	while #Parts < MaxParts and not RerunFailed do
		local Region = Region
		local PossibleParts = Functions.GetTotalParts(MaxParts, 100, #Parts)
		local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts)
		if #PartsNearby == 0 then
			RerunFailed = true
		else
			for i, v in pairs(PartsNearby) do
				table.insert(Parts, v)
				table.insert(Ignore, v)
			end
		end
	end
	return Parts
end

function Functions.CheckTableForInstance(Table, Instance)
	for i, v in pairs(Table) do
		if v == Instance then
			return true
		end
	end
	return false
end

return Functions
