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


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
