Functions={}Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")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"}function Functions.IsTeamMate(h,n)return h and(n and(not h.Neutral and(not n.Neutral and h.TeamColor==n.TeamColor)))end function Functions.Round(h,n)n=n or 0 local i=10^n return math.floor(h*i+.5)/i end function Functions.SigNum(h)if h==0 then return 1 end return math.abs(h)/h end function Functions.TagHumanoid(h,n)local i=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")i.Name="\099\114\101\097\116\111\114"i.Value=n Debris:AddItem(i,2)i.Parent=h end function Functions.UntagHumanoid(h)for h,n in pairs(h:GetChildren())do if n:IsA("\079\098\106\101\099\116\086\097\108\117\101")and n.Name=="\099\114\101\097\116\111\114"then n:Destroy()end end end function Functions.FindCharacterAncestor(h)if h and h~=game:GetService("\087\111\114\107\115\112\097\099\101")then if h:FindFirstChild("\072\117\109\097\110\111\105\100")then return h else return Functions.FindCharacterAncestor(h.Parent)end end return nil end function Functions.WeldBetween(h,n)local i=Instance.new("\087\101\108\100")i.Part0=h i.Part1=n i.C0=CFrame.new()i.C1=n.CFrame:inverse()*h.CFrame i.Parent=h return i end function CheckTableForString(h,n)for h,i in pairs(h)do if string.lower(i)==string.lower(n)then return true end end return false end function CheckIntangible(h)if h and h.Parent then if h.Transparency>.8 or CheckTableForString(ProjectileNames,h.Name)then return true end end return false end function Functions.CastRay(h,n,i,o,c)local O=type(o)=="\116\097\098\108\101"and o or{o}local l,L,E=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(h,n*i),O)if l and CheckIntangible(l)then if c then wait()end l,L,E=Functions.CastRay(L+n*.01,n,i-(h-L).magnitude,O,c)end return l,L,E end return Functions
--Rescripted by Luckymaxer

Functions = {}

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

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

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.Round(Number, Decimal)
	Decimal = (Decimal or 0)
	local Multiplier = (10 ^ Decimal)
	return (math.floor(Number * Multiplier + 0.5) / Multiplier)
end

function Functions.SigNum(Number)
	if Number == 0 then
		return 1
	end
	return (math.abs(Number) / Number)
end

function Functions.TagHumanoid(humanoid, player)
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.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.FindCharacterAncestor(Object)
	if Object and Object ~= game:GetService("Workspace") then
		if Object:FindFirstChild("Humanoid") then
			return Object
		else
			return Functions.FindCharacterAncestor(Object.Parent)
		end
	end
	return nil
end

function Functions.WeldBetween(Part1, Part2)
	local Weld = Instance.new("Weld")
	Weld.Part0 = Part1
	Weld.Part1 = Part2
	Weld.C0 = CFrame.new()
	Weld.C1 = Part2.CFrame:inverse() * Part1.CFrame
	Weld.Parent = Part1
	return Weld
end

function 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 CheckIntangible(Hit)
	if Hit and Hit.Parent then
		if Hit.Transparency > 0.8 or CheckTableForString(ProjectileNames, Hit.Name) 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 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

return Functions
