Projectile=script.Parent Projectile.Size=Vector3.new(.2,.2,.2)Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")Values={}for F,c in pairs(script:GetChildren())do if string.find(string.lower(c.ClassName),string.lower("\086\097\108\117\101"))then Values[c.Name]=c end end BaseProjectile=Values.BaseProjectile.Value function GetCreator()local F=Values.Creator.Value return(F and(F.Parent and F:IsA("\080\108\097\121\101\114")))and F or nil end function IsTeamMate(F,c)return F and(c and(not F.Neutral and(not c.Neutral and F.TeamColor==c.TeamColor)))end function TagHumanoid(F,c)local b=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")b.Name="\099\114\101\097\116\111\114"b.Value=c Debris:AddItem(b,2)b.Parent=F end function UntagHumanoid(F)for F,c in pairs(F: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 CheckTableForString(F,c)for F,b in pairs(F)do if string.find(string.lower(c),string.lower(b))then return true end end return false end function CheckIntangible(F)local c={"\087\097\116\101\114";"\080\097\114\116","\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 F and F.Parent then if(not F.CanCollide or CheckTableForString(c,F.Name))and not F.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then return true end end return false end function CastRay(F,c,b,D,W)local e=type(D)=="\116\097\098\108\101"and D or{D}local V,J,v=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(F,c*b),e)if V and CheckIntangible(V)then if W then wait()end V,J,v=CastRay(J+c*.01,c,b-(F-J).magnitude,e,W)end return V,J,v end function FlyProjectile(F,c)local b=false local D=GetCreator()local function W(F)if not F or not F.Parent or not D then return end local c=F.Parent if c:IsA("\072\097\116")then c=c.Parent end if not c then return end local b=Players:GetPlayerFromCharacter(c)if b and(b==D or IsTeamMate(D,b))then return end local W=c:FindFirstChild("\072\117\109\097\110\111\105\100")if not W or W.Health==0 then return end UntagHumanoid(W)TagHumanoid(W,D)W:TakeDamage(Values.Damage.Value)return c end local function e(c)local b={{Vector=F.CFrame.lookVector;Length=BaseProjectile.Size.Z+2},{Vector=Vector3.new(0,-1,0);Length=BaseProjectile.Size.Y*1.25};c and{Vector=(CFrame.new(F.Position,c.Position)).lookVector;Length=BaseProjectile.Size.Z+2}or nil}local W={DistanceApart=math.huge}for c,b in pairs(b)do if b then local c=(CFrame.new(F.Position,(F.CFrame+b.Vector*2).p)).lookVector local e,V,J=CastRay(F.Position+Vector3.new(0,0,0),c,b.Length,{D and D.Character or nil;F},false)if e then local c=(F.Position-V).Magnitude if c<W.DistanceApart then W={Hit=e;Pos=V;Normal=J;DistanceApart=c}end end end end return W.Hit and W or nil end local function V(D)if b then return end local V=e(D)if not V then return end b=true for F,c in pairs(F:GetChildren())do if c:IsA("\066\097\115\101\080\097\114\116")then for F,b in pairs(c:GetChildren())do if b:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then b.Enabled=false c.Anchored=true elseif b:IsA("\074\111\105\110\116\073\110\115\116\097\110\099\101")then b:Destroy()end end Debris:AddItem(c,8)elseif string.find(string.lower(c.ClassName),string.lower("\066\111\100\121"))then c:Destroy()end end local J=W(V.Hit)F.Size=Vector3.new(.2,.2,.2)F.CanCollide=false local v=V.Hit if J and v.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")or v.Parent.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then script.HitE:Fire(v)if Values.ProjectileLand.Value==true then local b=V.Pos local D=CFrame.new(b,c)D=(D*CFrame.new(0,0,-(BaseProjectile.Size.Z/2)+0))*CFrame.Angles(0,math.pi,0)local W=Instance.new("\077\111\116\111\114\054\068")W.Part0=v W.Part1=F W.C0=CFrame.new(0,0,0)W.C1=D:inverse()*v.CFrame W.Parent=F F.Orientation=F.Orientation+Values.ProjectileLandRotation.Value else script.Parent:Destroy()end else script.HitE:Fire(v)if Values.ProjectileLand.Value==true then local b=V.Pos local D=CFrame.new(b,c)D=(D*CFrame.new(0,0,-(BaseProjectile.Size.Z/2)+0))*CFrame.Angles(0,math.pi,0)local W=Instance.new("\077\111\116\111\114\054\068")W.Part0=v W.Part1=F W.C0=CFrame.new(0,0,0)W.C1=D:inverse()*v.CFrame W.Parent=F F.Orientation=F.Orientation+Values.ProjectileLandRotation.Value else script.Parent:Destroy()end end delay(Values.Lifetime.Value,function()Projectile:Destroy()end)F.Name="\069\102\102\101\099\116"end F.Touched:Connect(function(F)if not F or not F.Parent or b then return end V(F)end)spawn(function()while F and(F.Parent and(F.Name~="\069\102\102\101\099\116"and not b))do V()wait()end end)end FlyProjectile(Projectile,Values.Origin.Value)
-- Original script made by Luckymaxer [yes i edited this lol]

Projectile = script.Parent
Projectile.Size = Vector3.new(0.2, 0.2, 0.2)

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

Values = {}
for i, v in pairs(script:GetChildren()) do
	if string.find(string.lower(v.ClassName), string.lower("Value")) then
		Values[v.Name] = v
	end
end

BaseProjectile = Values.BaseProjectile.Value

function GetCreator()
	local Creator = Values.Creator.Value
	return (((Creator and Creator.Parent and Creator:IsA("Player")) and Creator) or nil)
end

function IsTeamMate(Player1, Player2)
	return (
		Player1
		and Player2
		and not Player1.Neutral
		and not Player2.Neutral
		and Player1.TeamColor == Player2.TeamColor
	)
end

function 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 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 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 CheckIntangible(Hit)
	local ProjectileNames = { "Water", "Part", "Projectile", "Effect", "Rail", "Laser", "Bullet" }
	if Hit and Hit.Parent then
		if
			(not Hit.CanCollide or CheckTableForString(ProjectileNames, Hit.Name))
			and not Hit.Parent:FindFirstChild("Humanoid")
		then
			return true
		end
	end
	return false
end

function 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 =
			CastRay((RayPos + (Vec * 0.01)), Vec, (Length - (StartPos - RayPos).magnitude), Ignore, DelayIfHit)
	end
	return RayHit, RayPos, RayNormal
end

function FlyProjectile(Part, StartPos)
	local AlreadyHit = false
	local Player = GetCreator()
	local function PartHit(Hit)
		if not Hit or not Hit.Parent or not Player then
			return
		end
		local character = Hit.Parent
		if character:IsA("Hat") then
			character = character.Parent
		end
		if not character then
			return
		end
		local player = Players:GetPlayerFromCharacter(character)
		if player and (player == Player or IsTeamMate(Player, player)) then
			return
		end
		local humanoid = character:FindFirstChild("Humanoid")
		if not humanoid or humanoid.Health == 0 then
			return
		end
		UntagHumanoid(humanoid)
		TagHumanoid(humanoid, Player)
		humanoid:TakeDamage(Values.Damage.Value)
		return character
	end
	local function CheckForContact(Hit)
		local Directions = {
			{ Vector = Part.CFrame.lookVector, Length = (BaseProjectile.Size.Z + 2) },
			{ Vector = Vector3.new(0, -1, 0), Length = (BaseProjectile.Size.Y * 1.25) },
			((Hit and {
				Vector = CFrame.new(Part.Position, Hit.Position).lookVector,
				Length = (BaseProjectile.Size.Z + 2),
			}) or nil),
		}
		local ClosestRay = { DistanceApart = math.huge }
		for i, v in pairs(Directions) do
			if v then
				local Direction = CFrame.new(Part.Position, (Part.CFrame + v.Vector * 2).p).lookVector
				local RayHit, RayPos, RayNormal = CastRay(
					(Part.Position + Vector3.new(0, 0, 0)),
					Direction,
					v.Length,
					{ ((Player and Player.Character) or nil), Part },
					false
				)
				if RayHit then
					local DistanceApart = (Part.Position - RayPos).Magnitude
					if DistanceApart < ClosestRay.DistanceApart then
						ClosestRay = { Hit = RayHit, Pos = RayPos, Normal = RayNormal, DistanceApart = DistanceApart }
					end
				end
			end
		end
		return ((ClosestRay.Hit and ClosestRay) or nil)
	end
	local function ConnectPart(Hit)
		if AlreadyHit then
			return
		end
		local ClosestRay = CheckForContact(Hit)
		if not ClosestRay then
			return
		end
		AlreadyHit = true
		for i, v in pairs(Part:GetChildren()) do
			if v:IsA("BasePart") then
				for ii, vv in pairs(v:GetChildren()) do
					if vv:IsA("ParticleEmitter") then
						vv.Enabled = false
						v.Anchored = true
					elseif vv:IsA("JointInstance") then
						vv:Destroy()
					end
				end
				Debris:AddItem(v, 8)
			elseif string.find(string.lower(v.ClassName), string.lower("Body")) then
				v:Destroy()
			end
		end
		local SuccessfullyHit = PartHit(ClosestRay.Hit)
		Part.Size = Vector3.new(0.2, 0.2, 0.2)
		Part.CanCollide = false
		local Hit = ClosestRay.Hit
		if
			SuccessfullyHit and Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
		then
			script.HitE:Fire(Hit)
			if Values.ProjectileLand.Value == true then
				local ProjectilePosition = ClosestRay.Pos
				local StickCFrame = CFrame.new(ProjectilePosition, StartPos)
				StickCFrame = (
					StickCFrame
					* CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0))
					* CFrame.Angles(0, math.pi, 0)
				)
				local Weld = Instance.new("Motor6D")
				Weld.Part0 = Hit
				Weld.Part1 = Part
				Weld.C0 = CFrame.new(0, 0, 0)
				Weld.C1 = (StickCFrame:inverse() * Hit.CFrame)
				Weld.Parent = Part
				Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value
			else
				script.Parent:Destroy()
			end
		else
			script.HitE:Fire(Hit)
			if Values.ProjectileLand.Value == true then
				local ProjectilePosition = ClosestRay.Pos
				local StickCFrame = CFrame.new(ProjectilePosition, StartPos)
				StickCFrame = (
					StickCFrame
					* CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0))
					* CFrame.Angles(0, math.pi, 0)
				)
				local Weld = Instance.new("Motor6D")
				Weld.Part0 = Hit
				Weld.Part1 = Part
				Weld.C0 = CFrame.new(0, 0, 0)
				Weld.C1 = (StickCFrame:inverse() * Hit.CFrame)
				Weld.Parent = Part
				Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value
			else
				script.Parent:Destroy()
			end
		end
		delay(Values.Lifetime.Value, function()
			Projectile:Destroy()
		end)
		Part.Name = "Effect"
	end
	Part.Touched:Connect(function(Hit)
		if not Hit or not Hit.Parent or AlreadyHit then
			return
		end
		ConnectPart(Hit)
	end)
	spawn(function()
		while Part and Part.Parent and Part.Name ~= "Effect" and not AlreadyHit do
			ConnectPart()
			wait()
		end
	end)
end

FlyProjectile(Projectile, Values.Origin.Value)
