local N=true local j=400 local C=true local f=16 FastCast.DebugLogging=false FastCast.VisualizeCasts=false FastCast.RayExit=true local o=Instance.new("\066\101\097\109")o.TextureSpeed=0 o.LightEmission=0 o.LightInfluence=1 o.Transparency=NumberSequence.new(0)local l=FastCast.new()local function b(j,C,f,l,b,A,J,R)if j~=nil and(C~=nil and f~=nil)then local c=CFrame.new(C,C+f)if A[1]then local C=Instance.new("\065\116\116\097\099\104\109\101\110\116")C.CFrame=c C.Parent=Workspace.Terrain local f local function s(s)if A[6][s.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\083\111\117\110\100\115")then local N=A[6][s.Name].MaterialSounds:GetChildren()local j=math.random(1,#N)local o=N[j]if o~=nil then f=o:Clone()if o:FindFirstChild("\080\105\116\099\104")then f.PlaybackSpeed=(Random.new()):NextNumber(o.Pitch.Min.Value,o.Pitch.Max.Value)else f.PlaybackSpeed=(Random.new()):NextNumber(A[3],A[4])end if o:FindFirstChild("\086\111\108\117\109\101")then f.Volume=(Random.new()):NextNumber(o.Volume.Min.Value,o.Volume.Max.Value)else f.Volume=A[5]end f.Parent=C end else f=Instance.new("\083\111\117\110\100",C)f.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..A[2][math.random(1,#A[2])]f.PlaybackSpeed=(Random.new()):NextNumber(A[3],A[4])f.Volume=A[5]end for f,o in pairs(A[6][s.Name]:GetChildren())do if o.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local f=1 local b=o:Clone()b.Parent=C if b:FindFirstChild("\069\109\105\116\067\111\117\110\116")then f=b.EmitCount.Value end if b.PartColor.Value then local N=j and j.Color or Color3.fromRGB(255,255,255)if j and j:IsA("\084\101\114\114\097\105\110")then N=Workspace.Terrain:GetMaterialColor(l or Enum.Material.Sand)end b.Color=ColorSequence.new(N,N)end Thread:Delay(.01,function()if N then local N=(UserSettings()).GameSettings.SavedQualityLevel if N==Enum.SavedQualitySetting.Automatic then local N=.5 b:Emit(f*N)else local j=N.Value/21 b:Emit(f*j)end else b:Emit(f)end Debris:AddItem(b,b.Lifetime.Max)end)end end f:Play()if J[1]then local C=Instance.new("\065\116\116\097\099\104\109\101\110\116")C.Parent=b and j or Workspace.Terrain C.WorldCFrame=c*CFrame.Angles(math.rad(90),math.rad(180),0)if b then local f=J[2]if A[6][s.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\072\111\108\101\083\105\122\101")then f=A[6][s.Name].MaterialHoleSize.Value end local b=Instance.new("\065\116\116\097\099\104\109\101\110\116")local c=Instance.new("\065\116\116\097\099\104\109\101\110\116")local M=o:Clone()M.Width0=f M.Width1=f if A[6][s.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\068\101\099\097\108\115")then local N=A[6][s.Name].MaterialDecals:GetChildren()local C=math.random(1,#N)local f=N[C]if f~=nil then M.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..f.Value if f.PartColor.Value then local N=j and j.Color or Color3.fromRGB(255,255,255)if j and j:IsA("\084\101\114\114\097\105\110")then N=Workspace.Terrain:GetMaterialColor(l or Enum.Material.Sand)end M.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,N),ColorSequenceKeypoint.new(1,N)})end end else M.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..J[3][math.random(1,#J[3])]if J[4]then local N=j and j.Color or Color3.fromRGB(255,255,255)if j and j:IsA("\084\101\114\114\097\105\110")then N=Workspace.Terrain:GetMaterialColor(l or Enum.Material.Sand)end M.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,N),ColorSequenceKeypoint.new(1,N)})end end M.Attachment0=b M.Attachment1=c b.Parent=j c.Parent=j b.WorldCFrame=(C.WorldCFrame*CFrame.new(f/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)c.WorldCFrame=(C.WorldCFrame*CFrame.new(-f/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)M.Parent=Workspace.Terrain Thread:Delay(J[5],function()if J[5]>0 then if N then if R then local N=os.clock()while C~=nil do local j=math.min((os.clock()-N)/J[6],1)if M then M.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if b then b:Destroy()end if c then c:Destroy()end if M then M:Destroy()end if C then C:Destroy()end else if b then b:Destroy()end if c then c:Destroy()end if M then M:Destroy()end if C then C:Destroy()end end else local N=os.clock()while C~=nil do local j=math.min((os.clock()-N)/J[6],1)if M then M.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if b then b:Destroy()end if c then c:Destroy()end if M then M:Destroy()end if C then C:Destroy()end end else if b then b:Destroy()end if c then c:Destroy()end if M then M:Destroy()end if C then C:Destroy()end end end)else Debris:AddItem(C,5)end end end if not A[7]then if A[6]:FindFirstChild(j.Material)then s(j.Material)else s(A[6].Custom)end else s(A[6].Custom)end Debris:AddItem(C,10)end end end local function A(j,C,f,l,b,A,J)if j~=nil and(C~=nil and f~=nil)then local R=CFrame.new(C,C+f)if A[1]then local j=Instance.new("\065\116\116\097\099\104\109\101\110\116")j.CFrame=R j.Parent=Workspace.Terrain local C=Instance.new("\083\111\117\110\100",j)C.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..A[2][math.random(1,#A[2])]C.PlaybackSpeed=(Random.new()):NextNumber(A[3],A[4])C.Volume=A[5]local function f()local f=A[6]:GetChildren()for C,o in pairs(A[6]:GetChildren())do if o.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local o=1 local l=f[C]:Clone()l.Parent=j if l:FindFirstChild("\069\109\105\116\067\111\117\110\116")then o=l.EmitCount.Value end Thread:Delay(.01,function()if N then local N=(UserSettings()).GameSettings.SavedQualityLevel if N==Enum.SavedQualitySetting.Automatic then local N=.5 l:Emit(o*N)else local j=N.Value/21 l:Emit(o*j)end else l:Emit(o)end Debris:AddItem(l,l.Lifetime.Max)end)end end C:Play()end Thread:Spawn(f)Debris:AddItem(j,10)end if A[7][1]then local C=Instance.new("\065\116\116\097\099\104\109\101\110\116")C.Parent=b and j or Workspace.Terrain C.WorldCFrame=R*CFrame.Angles(math.rad(90),math.rad(180),0)if b then local f=A[7][2]local b=Instance.new("\065\116\116\097\099\104\109\101\110\116")local R=Instance.new("\065\116\116\097\099\104\109\101\110\116")local c=o:Clone()c.Width0=f c.Width1=f c.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..A[7][3][math.random(1,#A[7][3])]c.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,A[7][4]);ColorSequenceKeypoint.new(1,A[7][4])})if A[7][7]then local N=j and j.Color or Color3.fromRGB(255,255,255)if j and j:IsA("\084\101\114\114\097\105\110")then N=Workspace.Terrain:GetMaterialColor(l or Enum.Material.Sand)end c.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,N);ColorSequenceKeypoint.new(1,N)})end c.Attachment0=b c.Attachment1=R b.Parent=j R.Parent=j b.WorldCFrame=(C.WorldCFrame*CFrame.new(f/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)R.WorldCFrame=(C.WorldCFrame*CFrame.new(-f/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)c.Parent=Workspace.Terrain Thread:Delay(A[7][5],function()if A[7][5]>0 then if N then if J then local N=os.clock()while C~=nil do local j=math.min((os.clock()-N)/A[7][6],1)if c then c.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if b then b:Destroy()end if R then R:Destroy()end if c then c:Destroy()end if C then C:Destroy()end else if b then b:Destroy()end if R then R:Destroy()end if c then c:Destroy()end if C then C:Destroy()end end else local N=os.clock()while C~=nil do local j=math.min((os.clock()-N)/A[7][6],1)if c then c.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if b then b:Destroy()end if R then R:Destroy()end if c then c:Destroy()end if C then C:Destroy()end end else if b then b:Destroy()end if R then R:Destroy()end if c then c:Destroy()end if C then C:Destroy()end end end)else Debris:AddItem(C,5)end end end end local function J(l,J,R,c,s,M,u,y,Z)local S=C and(ScreenCulling(c,f)and(c-Camera.CFrame.p).Magnitude<=j)or(c-Camera.CFrame.p).Magnitude<=j y.Transparency=1 for N,j in pairs(y:GetDescendants())do if j:IsA("\066\097\115\101\080\097\114\116")or j:IsA("\068\101\099\097\108")or j:IsA("\084\101\120\116\117\114\101")then j.Transparency=1 elseif j:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then j.Enabled=false elseif j:IsA("\083\111\117\110\100")then j:Stop()elseif j:IsA("\080\111\105\110\116\076\105\103\104\116")then j.Enabled=false elseif j:IsA("\066\101\097\109")then j.Enabled=false end end Debris:AddItem(y,5)if not Z[1][1]then if R~=nil and R.Parent~=nil then if Z[6]~=nil and R.Name=="\095\103\108\097\115\115"then ShatterGlass:FireServer(R,c,J)else local N=(c-l).Magnitude local j=R:FindFirstAncestorOfClass("\077\111\100\101\108")local C=j and j:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local f=j and(j:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or j:FindFirstChild("\072\101\097\100"))local o=Players:GetPlayerFromCharacter(Z[5].Parent)if C and(C.Health>0 and f)then if S then A(R,c,s,M,true,Z[4],Z[6])end if Z[6]~=nil then if C.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer(Z[7],Z[5],o,C,f,{Z[6][1][1];Z[6][1][2];Z[6][1][3];N,Z[6][1][4],Z[6][1][5];Z[6][1][6],Z[6][1][7]},{Z[6][2][1],Z[6][2][2];Z[6][2][3];Z[6][2][4];Z[6][2][5]},{Z[6][3][1];Z[6][3][2],Z[6][3][3]},R,{Z[6][4][1];Z[6][4][2],Z[6][4][3];Z[6][4][4];Z[6][4][5],Z[6][4][6];Z[6][4][7]})end)if Z[5].GunScript_Local:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then Z[5].GunScript_Local.MarkerEvent:Fire(R.Name=="\072\101\097\100"and Z[6][1][3])end end end else if S then b(R,c,s,M,true,Z[2],Z[3],Z[6])end end end end else if Z[1][3]then local N=Instance.new("\065\116\116\097\099\104\109\101\110\116")N.CFrame=CFrame.new(c)N.Parent=Workspace.Terrain local j=Instance.new("\083\111\117\110\100")j.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Z[1][4][math.random(1,#Z[1][4])]j.PlaybackSpeed=(Random.new()):NextNumber(Z[1][5],Z[1][6])j.Volume=Z[1][7]j.Parent=N j:Play()Debris:AddItem(N,10)end local j=Instance.new("\069\120\112\108\111\115\105\111\110")j.BlastRadius=Z[1][2]j.BlastPressure=0 j.ExplosionType=Enum.ExplosionType.NoCraters j.Position=c~=nil and c or y.Position j.Parent=Camera local C=R~=nil and(c~=nil and(s~=nil and CFrame.new(c,c+s)))or y.CFrame if S and(R~=nil and(c~=nil and s~=nil))then if Z[1][11]then local j=R:FindFirstAncestorOfClass("\077\111\100\101\108")if R and not R.Parent or not(j and j:FindFirstChildOfClass("\072\117\109\097\110\111\105\100"))then local j=true local f=Instance.new("\065\116\116\097\099\104\109\101\110\116")f.Parent=j and R or Workspace.Terrain f.WorldCFrame=C*CFrame.Angles(math.rad(90),math.rad(180),0)if j then local j=Z[1][12]local C=Instance.new("\065\116\116\097\099\104\109\101\110\116")local l=Instance.new("\065\116\116\097\099\104\109\101\110\116")local b=o:Clone()b.Width0=j b.Width1=j b.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Z[1][13][math.random(1,#Z[1][13])]if Z[1][14]then local N=R and R.Color or Color3.fromRGB(255,255,255)if R and R:IsA("\084\101\114\114\097\105\110")then N=Workspace.Terrain:GetMaterialColor(M or Enum.Material.Sand)end b.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,N);ColorSequenceKeypoint.new(1,N)})end b.Attachment0=C b.Attachment1=l C.Parent=R l.Parent=R C.WorldCFrame=(f.WorldCFrame*CFrame.new(j/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)l.WorldCFrame=(f.WorldCFrame*CFrame.new(-j/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)b.Parent=workspace.Terrain Thread:Delay(Z[1][15],function()if Z[1][15]>0 then if N then if Z[6]then local N=os.clock()while f~=nil do local j=math.min((os.clock()-N)/Z[1][16],1)if b then b.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if C then C:Destroy()end if l then l:Destroy()end if b then b:Destroy()end if f then f:Destroy()end else if C then C:Destroy()end if l then l:Destroy()end if b then b:Destroy()end if f then f:Destroy()end end else local N=os.clock()while f~=nil do local j=math.min((os.clock()-N)/Z[1][16],1)if b then b.Transparency=NumberSequence.new(Math.Lerp(0,1,j))end if j==1 then break end Thread:Wait()end if C then C:Destroy()end if l then l:Destroy()end if b then b:Destroy()end if f then f:Destroy()end end else if C then C:Destroy()end if l then l:Destroy()end if b then b:Destroy()end if f then f:Destroy()end end end)else Debris:AddItem(f,5)end end end end if Z[1][8]then j.Visible=false if S then local j=Instance.new("\065\116\116\097\099\104\109\101\110\116")j.CFrame=C j.Parent=Workspace.Terrain local function f()for C,f in pairs(Z[1][9]:GetChildren())do if f.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local C=1 local o=f:Clone()o.Parent=j if o:FindFirstChild("\069\109\105\116\067\111\117\110\116")then C=o.EmitCount.Value end Thread:Delay(.01,function()if N then local N=(UserSettings()).GameSettings.SavedQualityLevel if N==Enum.SavedQualitySetting.Automatic then local N=.5 o:Emit(C*N)else local j=N.Value/21 o:Emit(C*j)end else o:Emit(C)end Debris:AddItem(o,o.Lifetime.Max)end)end end end Thread:Spawn(f)Debris:AddItem(j,10)end end local f={}j.Hit:Connect(function(N,C)if N and Z[6]~=nil then if N.Parent and N.Name=="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"or N.Name=="\072\101\097\100"then local o=(c-l).Magnitude local b=N:FindFirstAncestorOfClass("\077\111\100\101\108")local A=b and b:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local J=b and(b:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or b:FindFirstChild("\072\101\097\100"))local R=Players:GetPlayerFromCharacter(Z[5].Parent)if A then if A.Health>0 then if not f[A]then if Z[1][17]then local N=Z[1][20]local f=C/Z[1][2]f=1-f local o=(J.Position-j.Position).Unit*Z[1][18]local l=(J.Velocity-Vector3.new(0,J.Velocity.y,0))+Vector3.new(o.X,0,o.Z)if DamageModule.CanDamage(b,Z[5].Parent,Z[6][1][7])then local j=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")j.MaxForce=Vector3.new(math.huge,0,math.huge)j.Velocity=l j.Parent=J J.Velocity=J.Velocity+Vector3.new(0,o.Y*N,0)Debris:AddItem(j,.25)else if A.Parent.Name==R.Name then N=Z[1][19]local j=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")j.MaxForce=Vector3.new(math.huge,0,math.huge)j.Velocity=l j.Parent=J J.Velocity=J.Velocity+Vector3.new(0,o.Y*N,0)Debris:AddItem(j,.25)end end end Thread:Spawn(function()InflictTarget:InvokeServer(Z[7],Z[5],R,A,J,{Z[6][1][1];Z[6][1][2],Z[6][1][3];o;Z[6][1][4];Z[6][1][5],Z[6][1][6];Z[6][1][7]},{Z[6][2][1];Z[6][2][2],Z[6][2][3];Z[6][2][4],Z[6][2][5]},{Z[6][3][1];Z[6][3][2],Z[6][3][3]},N,{Z[6][4][1];Z[6][4][2],Z[6][4][3];Z[6][4][4];Z[6][4][5],Z[6][4][6];Z[6][4][7]},{Z[1][1];Z[1][2],C;Z[1][10];Z[1][21],Z[1][22],Z[1][23]})end)if Z[5].GunScript_Local:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then Z[5].GunScript_Local.MarkerEvent:Fire(N.Name=="\072\101\097\100"and Z[6][1][3])end f[A]=true end end end elseif N.Name=="\095\103\108\097\115\115"then ShatterGlass:FireServer(N,N.Position,J)end end end)end end local function R(N,o,l,J,R,c,s,M)local u=C and(ScreenCulling(J,f)and(J-Camera.CFrame.p).Magnitude<=j)or(J-Camera.CFrame.p).Magnitude<=j if l~=nil and l.Parent~=nil then if M[6]~=nil and l.Name=="\095\103\108\097\115\115"then ShatterGlass:FireServer(l,J,o)return"\112\101\110\101\116\114\097\116\101\100\079\098\106\101\099\116"else local j=(J-N).Magnitude local C=l:FindFirstAncestorOfClass("\077\111\100\101\108")local f=C and C:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local o=C and(C:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or C:FindFirstChild("\072\101\097\100"))local s=Players:GetPlayerFromCharacter(M[5].Parent)if f and(f.Health>0 and o)then if u then A(l,J,R,c,true,M[4],M[6])end if M[6]~=nil then if f.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer(M[7],M[5],s,f,o,{M[6][1][1],M[6][1][2],M[6][1][3];j;M[6][1][4],M[6][1][5];M[6][1][6];M[6][1][7]},{M[6][2][1],M[6][2][2],M[6][2][3];M[6][2][4],M[6][2][5]},{M[6][3][1],M[6][3][2],M[6][3][3]},l,{M[6][4][1],M[6][4][2];M[6][4][3],M[6][4][4],M[6][4][5],M[6][4][6];M[6][4][7]})end)if M[5].GunScript_Local:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then M[5].GunScript_Local.MarkerEvent:Fire(l.Name=="\072\101\097\100"and M[6][1][3])end end end return"\112\101\110\101\116\114\097\116\101\100\072\117\109\097\110\111\105\100"else if u then b(l,J,R,c,true,M[2],M[3],M[6])end return"\112\101\110\101\116\114\097\116\101\100\079\098\106\101\099\116"end end end end local function c(N,o,l,b,J,R,c,s,M)local u=C and(ScreenCulling(b,f)and(b-Camera.CFrame.p).Magnitude<=j)or(b-Camera.CFrame.p).Magnitude<=j if l~=nil and l.Parent~=nil then if l.Transparency>.75 or l.Name=="\072\097\110\100\108\101"or l.Name=="\069\102\102\101\099\116"or l.Name=="\066\117\108\108\101\116"or l.Name=="\076\097\115\101\114"or string.lower(l.Name)=="\119\097\116\101\114"or l.Name=="\082\097\105\108"or l.Name=="\065\114\114\111\119"or l.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and l.Parent.Humanoid.Health==0 then return true else local j=(b-N).Magnitude local C=l:FindFirstAncestorOfClass("\077\111\100\101\108")local f=C and C:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local o=C and(C:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or C:FindFirstChild("\072\101\097\100"))local c=Players:GetPlayerFromCharacter(M[5].Parent)if f and(f.Health>0 and o)then if s>0 then if u then A(l,b,J,R,true,M[4],M[6])end if M[6]~=nil then if f.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer(M[7],M[5],c,f,o,{M[6][1][1];M[6][1][2],M[6][1][3],j;M[6][1][4],M[6][1][5],M[6][1][6],M[6][1][7]},{M[6][2][1];M[6][2][2],M[6][2][3];M[6][2][4],M[6][2][5]},{M[6][3][1];M[6][3][2],M[6][3][3]},l,{M[6][4][1];M[6][4][2];M[6][4][3],M[6][4][4],M[6][4][5],M[6][4][6],M[6][4][7]})end)if M[5].GunScript_Local:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then M[5].GunScript_Local.MarkerEvent:Fire(l.Name=="\072\101\097\100"and M[6][1][3])end end end end return true end end end return false end local function s(N,o,l,J,R,c,s,M)local u=C and(ScreenCulling(J,f)and(J-Camera.CFrame.p).Magnitude<=j)or(J-Camera.CFrame.p).Magnitude<=j if l.Name=="\095\103\108\097\115\115"then return else local N=l:FindFirstAncestorOfClass("\077\111\100\101\108")local j=N and N:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local C=N and(N:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or N:FindFirstChild("\072\101\097\100"))if j and(j.Health>0 and C)then if u then A(l,J,R,c,true,M[4],M[6])end else if u then b(l,J,R,c,true,M[2],M[3],M[6])end end end end local function M(N,j,C,f,o,l,b,A,J)local R=l.Size.Z/2 local c=CFrame.new(j,j+C)if b[1]then l.CFrame=(c*CFrame.new(0,0,-(f-R)))*CFrame.Angles(math.rad(-360*(os.clock()*b[2]-math.floor(os.clock()*b[2]))),math.rad(-360*(os.clock()*b[3]-math.floor(os.clock()*b[3]))),math.rad(-360*(os.clock()*b[4]-math.floor(os.clock()*b[4]))))else l.CFrame=c*CFrame.new(0,0,-(f-R))end if J[6]==nil and(A[1]and(l.Parent and l:FindFirstChild("\087\104\105\122\122\101\100")))then local N=l:FindFirstChild("\087\104\105\122\122\101\100")if not N.Value then local j=(Camera.CFrame.p-l.Position).Magnitude if j<A[5]then local j=Instance.new("\083\111\117\110\100")j.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..A[2][math.random(1,#A[2])]j.Volume=A[6]j.PlaybackSpeed=(Random.new()):NextNumber(A[3],A[4])j.Name="\087\104\105\122\083\111\117\110\100"j.Parent=SoundService j:Play()Debris:AddItem(j,j.TimeLength/j.PlaybackSpeed)N.Value=true end end end end function ProjectileHandler.VisualizeHitEffect(s,N,o,l,J,R,c,...)if o then VisualizeHitEffect:FireServer(N,nil,l,J,R,c,...)end local M=C and(ScreenCulling(J,f)and(J-Camera.CFrame.p).Magnitude<=j)or(J-Camera.CFrame.p).Magnitude<=j if M then if N=="\078\111\114\109\097\108"then b(l,J,R,c,...)elseif N=="\066\108\111\111\100"then A(l,J,R,c,...)end end end function ProjectileHandler.SimulateProjectile(Z,N,j,C,f,o,b,A,J,s,M,u,y)if N and(j and C)then if y~=nil then VisualizeBullet:FireServer(N,j,C,f,o,b,A,J,s,M,u,nil)end for f,Z in pairs(f)do local S,Q=o.WorldPosition,Z if o~=nil then local N=o.WorldCFrame local f=N.Position local l=N.LookVector local b=math.abs(((j.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")).Position-f):Dot(l))+1 local A=Ray.new(f-l.Unit*b,l.Unit*b)local J,R=Workspace:FindPartOnRayWithIgnoreList(A,{C;j.Parent;Camera},false,true)if J and math.abs((f-R).Magnitude)>0 then S=R-l.Unit*.1 end end local i=j.Parent:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116",1)local X=i.Velocity local H=Q*M[2]local d=Projectiles[M[1]]:Clone()d.CFrame=CFrame.new(S,S+Q)d.Parent=Camera local F=Instance.new("\066\111\111\108\086\097\108\117\101")F.Name="\087\104\105\122\122\101\100"F.Value=false F.Parent=d for N,j in pairs(d:GetDescendants())do if j:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then j.Enabled=true elseif j:IsA("\083\111\117\110\100")then j:Play()elseif j:IsA("\080\111\105\110\116\076\105\103\104\116")then j.Enabled=true elseif j:IsA("\084\114\097\105\108")then j.Enabled=true elseif j:IsA("\066\101\097\109")then j.Enabled=true end end if y~=nil then if(M[10]>0 or M[11]>0)and not s[1]then l:FireWithBlacklist(S,Q*M[4],H,{C,j.Parent;Camera},d,true,M[3],{M[6];M[7],M[8],M[9]},u,{{s[1],s[2],s[3];s[4],s[5];s[6];s[7];s[8];s[9];s[10];s[11],s[12],s[13],s[14],s[15];s[16],s[17],s[18],s[19],s[20];s[21];s[22];s[23]};{b[1];b[2],b[3],b[4],b[5];b[6],b[7];b[8]};{J[1];J[2];J[3],J[4],J[5],J[6]},{A[1],A[2],A[3];A[4],A[5],A[6];A[7]},j;{{y[1][1],y[1][2],y[1][3];y[1][4];y[1][5];y[1][6],y[1][7]},{y[2][1],y[2][2];y[2][3],y[2][4];y[2][5],y[2][6],y[2][7],y[2][8]},{y[3][1],y[3][2],y[3][3]},{y[4][1];y[4][2];y[4][3],y[4][4];y[4][5],y[4][6];y[4][7]}},N},{penetrationType=M[5],penetrationDepth=M[10];canPenetrateFunction=R,penetrationAmount=M[11];canPenetrateHumanoidFunction=c})else l:FireWithBlacklist(S,Q*M[4],H,{C,j.Parent,Camera},d,true,M[3],{M[6],M[7],M[8];M[9]},u,{{s[1];s[2],s[3];s[4],s[5],s[6];s[7],s[8];s[9],s[10];s[11],s[12],s[13];s[14],s[15],s[16],s[17],s[18];s[19];s[20],s[21],s[22],s[23]};{b[1];b[2],b[3],b[4];b[5],b[6],b[7],b[8]},{J[1];J[2],J[3],J[4];J[5];J[6]},{A[1],A[2],A[3],A[4],A[5];A[6];A[7]};j;{{y[1][1],y[1][2];y[1][3];y[1][4];y[1][5];y[1][6],y[1][7]},{y[2][1],y[2][2];y[2][3],y[2][4];y[2][5];y[2][6];y[2][7];y[2][8]};{y[3][1];y[3][2];y[3][3]};{y[4][1],y[4][2],y[4][3];y[4][4],y[4][5];y[4][6],y[4][7]}},N},nil)end else if(M[10]>0 or M[11]>0)and not s[1]then l:FireWithBlacklist(S,Q*M[4],H,{C;j.Parent,Camera},d,true,M[3],{M[6];M[7],M[8];M[9]},u,{{s[1],s[2];s[3],s[4];s[5];s[6];s[7];s[8],s[9];s[10],s[11],s[12];s[13],s[14],s[15];s[16],s[17];s[18],s[19];s[20];s[21],s[22];s[23]};{b[1],b[2];b[3];b[4],b[5];b[6],b[7];b[8]};{J[1];J[2];J[3];J[4];J[5],J[6]},{A[1];A[2];A[3],A[4];A[5],A[6];A[7]},j;nil,N},{penetrationType=M[5];penetrationDepth=M[10];canPenetrateFunction=R;penetrationAmount=M[11],canPenetrateHumanoidFunction=c})else l:FireWithBlacklist(S,Q*M[4],H,{C;j.Parent,Camera},d,true,M[3],{M[6],M[7];M[8];M[9]},u,{{s[1];s[2],s[3],s[4];s[5],s[6];s[7];s[8];s[9],s[10];s[11];s[12],s[13];s[14];s[15],s[16];s[17];s[18],s[19],s[20],s[21];s[22];s[23]};{b[1];b[2],b[3];b[4],b[5],b[6];b[7],b[8]},{J[1],J[2];J[3],J[4];J[5];J[6]};{A[1],A[2],A[3],A[4],A[5];A[6],A[7]},j,nil,N},nil)end end end end end l.LengthChanged:Connect(M)l.RayHit:Connect(J)l.RayExited:Connect(s)return ProjectileHandler

local OptimalEffects = true
local RenderDistance = 400
local ScreenCullingEnabled = true
local ScreenCullingRadius = 16
FastCast.DebugLogging = false
FastCast.VisualizeCasts = false
FastCast.RayExit = true -- Only applies for Wall Penetration.

local Beam = Instance.new("Beam")
Beam.TextureSpeed = 0
Beam.LightEmission = 0
Beam.LightInfluence = 1
Beam.Transparency = NumberSequence.new(0)

local Caster = FastCast.new()

local function MakeImpactFX(Hit, Position, Normal, Material, ParentToPart, HitEffectData, BulletHoleData, ClientData)
	if Hit ~= nil and Position ~= nil and Normal ~= nil then
		local SurfaceCF = CFrame.new(Position, Position + Normal)
			
   		if HitEffectData[1] then		
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = SurfaceCF
	    	Attachment.Parent = Workspace.Terrain
			local Sound
			
			local function Spawner(material)
				if HitEffectData[6][material.Name]:FindFirstChild("MaterialSounds") then
		            local tracks = HitEffectData[6][material.Name].MaterialSounds:GetChildren()
		            local rn = math.random(1, #tracks)
		            local track = tracks[rn]
		            if track ~= nil then
						Sound = track:Clone()
						if track:FindFirstChild("Pitch") then
							Sound.PlaybackSpeed = Random.new():NextNumber(track.Pitch.Min.Value, track.Pitch.Max.Value)
						else
							Sound.PlaybackSpeed = Random.new():NextNumber(HitEffectData[3], HitEffectData[4])
						end
						if track:FindFirstChild("Volume") then
							Sound.Volume = Random.new():NextNumber(track.Volume.Min.Value, track.Volume.Max.Value)
						else
							Sound.Volume = HitEffectData[5]
						end
						Sound.Parent = Attachment
		            end
				else
					Sound = Instance.new("Sound",Attachment)
					Sound.SoundId = "rbxassetid://"..HitEffectData[2][math.random(1, #HitEffectData[2])]
					Sound.PlaybackSpeed = Random.new():NextNumber(HitEffectData[3], HitEffectData[4])
					Sound.Volume = HitEffectData[5]
				end
				for i, v in pairs(HitEffectData[6][material.Name]:GetChildren()) do
					if v.ClassName == "ParticleEmitter" then
						local Count = 1
						local Particle = v:Clone()
						Particle.Parent = Attachment
						if Particle:FindFirstChild("EmitCount") then
							Count = Particle.EmitCount.Value
						end
						if Particle.PartColor.Value then
							local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
							if Hit and Hit:IsA("Terrain") then
								HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
							end
							Particle.Color = ColorSequence.new(HitPartColor, HitPartColor)
						end
						Thread:Delay(0.01, function()
							if OptimalEffects then
								local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
								if QualityLevel == Enum.SavedQualitySetting.Automatic then
									local Compressor = 1 / 2
									Particle:Emit(Count * Compressor)
								else
									local Compressor = QualityLevel.Value / 21
									Particle:Emit(Count * Compressor)
								end
							else
								Particle:Emit(Count)
							end
							Debris:AddItem(Particle, Particle.Lifetime.Max)
						end)					
					end
				end
	        	Sound:Play()
			    if BulletHoleData[1] then
					local Hole = Instance.new("Attachment")
					Hole.Parent = ParentToPart and Hit or Workspace.Terrain
					Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
					if ParentToPart then
						local Scale = BulletHoleData[2]
						if HitEffectData[6][material.Name]:FindFirstChild("MaterialHoleSize") then
							Scale = HitEffectData[6][material.Name].MaterialHoleSize.Value
						end
						local A0 = Instance.new("Attachment")
						local A1 = Instance.new("Attachment")
						local BeamClone = Beam:Clone()
						BeamClone.Width0 = Scale
						BeamClone.Width1 = Scale
						if HitEffectData[6][material.Name]:FindFirstChild("MaterialDecals") then
				            local Decals = HitEffectData[6][material.Name].MaterialDecals:GetChildren()
							local Chosen = math.random(1, #Decals)
							local Decal = Decals[Chosen]
							if Decal ~= nil then
								BeamClone.Texture = "rbxassetid://"..Decal.Value
								if Decal.PartColor.Value then
									local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
									if Hit and Hit:IsA("Terrain") then
										HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
									end
									BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
								end
				            end
						else
							BeamClone.Texture = "rbxassetid://"..BulletHoleData[3][math.random(1, #BulletHoleData[3])]
						    if BulletHoleData[4] then
								local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
								if Hit and Hit:IsA("Terrain") then
									HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
								end
								BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
							end
						end
						BeamClone.Attachment0 = A0
						BeamClone.Attachment1 = A1
						A0.Parent = Hit
						A1.Parent = Hit
						A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
						A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
						BeamClone.Parent = Workspace.Terrain
						Thread:Delay(BulletHoleData[5], function()
							if BulletHoleData[5] > 0 then
								if OptimalEffects then
									if ClientData then
										local t0 = os.clock()
										while Hole ~= nil do
											local Alpha = math.min((os.clock() - t0) / BulletHoleData[6], 1)
											if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
										    if Alpha == 1 then break end
									      	Thread:Wait()
										end
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									else
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									end
								else
									local t0 = os.clock()
									while Hole ~= nil do
										local Alpha = math.min((os.clock() - t0) / BulletHoleData[6], 1)
										if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
									    if Alpha == 1 then break end
									    Thread:Wait()
									end
									if A0 then A0:Destroy() end
									if A1 then A1:Destroy() end
									if BeamClone then BeamClone:Destroy() end
									if Hole then Hole:Destroy() end
								end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
						    end
						end)
					else
						Debris:AddItem(Hole, 5)
					end
			    end
			end
		
			if not HitEffectData[7] then
				if HitEffectData[6]:FindFirstChild(Hit.Material) then
					Spawner(Hit.Material)
				else
					Spawner(HitEffectData[6].Custom)
				end
        	else
				Spawner(HitEffectData[6].Custom)
        	end

			Debris:AddItem(Attachment, 10)				
		end
	end
end

local function MakeBloodFX(Hit, Position, Normal, Material, ParentToPart, BloodEffectData, ClientData)
	if Hit ~= nil and Position ~= nil and Normal ~= nil then
		local SurfaceCF = CFrame.new(Position, Position + Normal)
		
	    if BloodEffectData[1] then
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = SurfaceCF
			Attachment.Parent = Workspace.Terrain
			
			local Sound = Instance.new("Sound",Attachment)
			Sound.SoundId = "rbxassetid://"..BloodEffectData[2][math.random(1, #BloodEffectData[2])]
			Sound.PlaybackSpeed = Random.new():NextNumber(BloodEffectData[3], BloodEffectData[4])
			Sound.Volume = BloodEffectData[5]
		
			local function Spawner()
				local C = BloodEffectData[6]:GetChildren()
				for i, v in pairs(BloodEffectData[6]:GetChildren()) do
					if v.ClassName == "ParticleEmitter" then
						local Count = 1
						local Particle = C[i]:Clone()
						Particle.Parent = Attachment
						if Particle:FindFirstChild("EmitCount") then
							Count = Particle.EmitCount.Value
						end
						Thread:Delay(0.01, function()
							if OptimalEffects then
								local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
								if QualityLevel == Enum.SavedQualitySetting.Automatic then
									local Compressor = 1 / 2
									Particle:Emit(Count * Compressor)
								else
									local Compressor = QualityLevel.Value / 21
									Particle:Emit(Count * Compressor)
								end
							else
								Particle:Emit(Count)
							end
							Debris:AddItem(Particle, Particle.Lifetime.Max)
						end)
					end
				end
		        Sound:Play()
			end
			
			Thread:Spawn(Spawner)
		    Debris:AddItem(Attachment, 10)
		end
		
		if BloodEffectData[7][1] then
			local Hole = Instance.new("Attachment")
			Hole.Parent = ParentToPart and Hit or Workspace.Terrain
			Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
			if ParentToPart then
				local Scale = BloodEffectData[7][2]
				local A0 = Instance.new("Attachment")
				local A1 = Instance.new("Attachment")
				local BeamClone = Beam:Clone()
				BeamClone.Width0 = Scale
				BeamClone.Width1 = Scale
				BeamClone.Texture = "rbxassetid://"..BloodEffectData[7][3][math.random(1, #BloodEffectData[7][3])]
				BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, BloodEffectData[7][4]), ColorSequenceKeypoint.new(1, BloodEffectData[7][4])})
				if BloodEffectData[7][7] then
					local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
					if Hit and Hit:IsA("Terrain") then
						HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
					end
					BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
				end				
				BeamClone.Attachment0 = A0
				BeamClone.Attachment1 = A1
				A0.Parent = Hit
				A1.Parent = Hit
				A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
				A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
				BeamClone.Parent = Workspace.Terrain
				Thread:Delay(BloodEffectData[7][5], function()
					if BloodEffectData[7][5] > 0 then
						if OptimalEffects then
							if ClientData then
								local t0 = os.clock()
								while Hole ~= nil do
									local Alpha = math.min((os.clock() - t0) / BloodEffectData[7][6], 1)
									if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
								    if Alpha == 1 then break end
							      	Thread:Wait()
								end
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
							end
						else
							local t0 = os.clock()
							while Hole ~= nil do
								local Alpha = math.min((os.clock() - t0) / BloodEffectData[7][6], 1)
								if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
							    if Alpha == 1 then break end
							    Thread:Wait()
							end
							if A0 then A0:Destroy() end
							if A1 then A1:Destroy() end
							if BeamClone then BeamClone:Destroy() end
							if Hole then Hole:Destroy() end
						end
					else
						if A0 then A0:Destroy() end
						if A1 then A1:Destroy() end
						if BeamClone then BeamClone:Destroy() end
					    if Hole then Hole:Destroy() end
				    end
				end)
			else
				Debris:AddItem(Hole, 5)
			end
		end
	end	
end

local function OnRayHit(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, cosmeticBulletObject, hitData)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	cosmeticBulletObject.Transparency = 1
	for i, v in pairs(cosmeticBulletObject:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal") or v:IsA("Texture")) then
			v.Transparency = 1
		elseif v:IsA("ParticleEmitter") then
			v.Enabled = false
		elseif v:IsA("Sound") then
			v:Stop()
		elseif v:IsA("PointLight") then
			v.Enabled = false
		--[[elseif v:IsA("Trail") then -- There is a case that trail is barely visible when projectile hits (especially at high speed). So I marked it as comment.
			v.Enabled = false]]
		elseif v:IsA("Beam") then
			v.Enabled = false
		end
	end
	Debris:AddItem(cosmeticBulletObject, 5) -- 10
	if not hitData[1][1] then
	    if hitPart ~= nil and hitPart.Parent ~= nil then
			if hitData[6] ~= nil and hitPart.Name == "_glass" then
				ShatterGlass:FireServer(hitPart, hitPoint, direction)
			else
				local Distance = (hitPoint - origin).Magnitude
				local Target = hitPart:FindFirstAncestorOfClass("Model")
				local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
				local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
				local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
				if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
					if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
					if hitData[6] ~= nil then
						if TargetHumanoid.Health > 0 then
							Thread:Spawn(function()
								InflictTarget:InvokeServer(hitData[7], hitData[5],
			                    	Tagger,
			                       	TargetHumanoid,
					                TargetTorso,
									{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3],Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
					                {hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
					                {hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
					                hitPart,
					                {hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
							end)
							if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
								hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
							end
						end
					end
		   		else
					if ShowEffects then
						MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6])
					end
		   		end
			end
		end
    else
	    if hitData[1][3] then
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = CFrame.new(hitPoint)
			Attachment.Parent = Workspace.Terrain
			local Sound = Instance.new("Sound")
		    Sound.SoundId = "rbxassetid://"..hitData[1][4][math.random(1, #hitData[1][4])]
		    Sound.PlaybackSpeed = Random.new():NextNumber(hitData[1][5], hitData[1][6])
		    Sound.Volume = hitData[1][7]
		    Sound.Parent = Attachment
		    Sound:Play()
			Debris:AddItem(Attachment, 10)		
		end
		
		local Explosion = Instance.new("Explosion")
		Explosion.BlastRadius = hitData[1][2]
		Explosion.BlastPressure = 0
		Explosion.ExplosionType = Enum.ExplosionType.NoCraters
	    Explosion.Position = hitPoint ~= nil and hitPoint or cosmeticBulletObject.Position 
		Explosion.Parent = Camera
		
		local SurfaceCF = hitPart ~= nil and hitPoint ~= nil and normal ~= nil and CFrame.new(hitPoint, hitPoint + normal) or cosmeticBulletObject.CFrame
		
		if ShowEffects and hitPart ~= nil and hitPoint ~= nil and normal ~= nil then
			if hitData[1][11] then
				local Target = hitPart:FindFirstAncestorOfClass("Model")
				if hitPart and not hitPart.Parent or not (Target and Target:FindFirstChildOfClass("Humanoid")) then
					local ParentToPart = true
					local Hole = Instance.new("Attachment")
					Hole.Parent = ParentToPart and hitPart or Workspace.Terrain
					Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
					if ParentToPart then
						local Scale = hitData[1][12]
						local A0 = Instance.new("Attachment")
						local A1 = Instance.new("Attachment")
						local BeamClone = Beam:Clone()
						BeamClone.Width0 = Scale
						BeamClone.Width1 = Scale
						BeamClone.Texture = "rbxassetid://"..hitData[1][13][math.random(1, #hitData[1][13])]
				    	if hitData[1][14] then
							local HitPartColor = hitPart and hitPart.Color or Color3.fromRGB(255, 255, 255)
							if hitPart and hitPart:IsA("Terrain") then
								HitPartColor = Workspace.Terrain:GetMaterialColor(material or Enum.Material.Sand)
							end
							BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
						end			
						BeamClone.Attachment0 = A0
						BeamClone.Attachment1 = A1
						A0.Parent = hitPart
						A1.Parent = hitPart
						A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
						A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
						BeamClone.Parent = workspace.Terrain
						Thread:Delay(hitData[1][15], function()
							if hitData[1][15] > 0 then
								if OptimalEffects then
									if hitData[6] then
										local t0 = os.clock()
										while Hole ~= nil do
											local Alpha = math.min((os.clock() - t0) / hitData[1][16], 1)
											if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
										    if Alpha == 1 then break end
									      	Thread:Wait()
										end
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									else
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									end
								else
									local t0 = os.clock()
									while Hole ~= nil do
										local Alpha = math.min((os.clock() - t0) / hitData[1][16], 1)
										if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
									    if Alpha == 1 then break end
									    Thread:Wait()
									end
									if A0 then A0:Destroy() end
									if A1 then A1:Destroy() end
									if BeamClone then BeamClone:Destroy() end
									if Hole then Hole:Destroy() end
								end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
						    end
						end)
					else
						Debris:AddItem(Hole, 5)
					end
				end
			end
		end
		
		if hitData[1][8] then
			Explosion.Visible = false
			
			if ShowEffects then
			    local Attachment = Instance.new("Attachment")
			    Attachment.CFrame = SurfaceCF
		        Attachment.Parent = Workspace.Terrain
		
				local function Spawner()
					for i, v in pairs(hitData[1][9]:GetChildren()) do
						if v.ClassName == "ParticleEmitter" then
							local Count = 1
							local Particle = v:Clone()
							Particle.Parent = Attachment
							if Particle:FindFirstChild("EmitCount") then
								Count = Particle.EmitCount.Value
							end
							Thread:Delay(0.01, function()
								if OptimalEffects then
									local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
									if QualityLevel == Enum.SavedQualitySetting.Automatic then
										local Compressor = 1 / 2
										Particle:Emit(Count * Compressor)
									else
										local Compressor = QualityLevel.Value / 21
										Particle:Emit(Count * Compressor)
									end
								else
									Particle:Emit(Count)
								end
								Debris:AddItem(Particle, Particle.Lifetime.Max)
							end)
						end
					end
			    end
			
				Thread:Spawn(Spawner)
		        Debris:AddItem(Attachment, 10)
			end
		end	
		
		local HitHumanoids = {}
		
		Explosion.Hit:Connect(function(HitPart, HitDist)
			if HitPart and hitData[6] ~= nil then
				if HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
					local Distance = (hitPoint - origin).Magnitude
					local Target = HitPart:FindFirstAncestorOfClass("Model")
					local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
					local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
					local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
					if TargetHumanoid then
						if TargetHumanoid.Health > 0 then
							if not HitHumanoids[TargetHumanoid] then
								if hitData[1][17] then
									local Multipler = hitData[1][20]
									local DistanceFactor = HitDist / hitData[1][2]
									DistanceFactor = 1 - DistanceFactor
									local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * hitData[1][18] --* DistanceFactor
									local AirVelocity = TargetTorso.Velocity - Vector3.new(0, TargetTorso.Velocity.y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z)
									if DamageModule.CanDamage(Target, hitData[5].Parent, hitData[6][1][7]) then
										local TorsoFly = Instance.new("BodyVelocity")
										TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
										TorsoFly.Velocity = AirVelocity
										TorsoFly.Parent = TargetTorso
										TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
										Debris:AddItem(TorsoFly, 0.25)	
									else
										if TargetHumanoid.Parent.Name == Tagger.Name then
											Multipler = hitData[1][19]
											local TorsoFly = Instance.new("BodyVelocity")
											TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
											TorsoFly.Velocity = AirVelocity
											TorsoFly.Parent = TargetTorso
											TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
											Debris:AddItem(TorsoFly, 0.25)
										end
									end							
								end
								Thread:Spawn(function()
									InflictTarget:InvokeServer(hitData[7], hitData[5],
										Tagger,
										TargetHumanoid,
										TargetTorso,
										{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
										{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
										{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
										HitPart,
										{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]},
										{hitData[1][1], hitData[1][2], HitDist, hitData[1][10], hitData[1][21], hitData[1][22], hitData[1][23]})
								end)
								if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
									hitData[5].GunScript_Local.MarkerEvent:Fire(HitPart.Name == "Head" and hitData[6][1][3])
								end
								HitHumanoids[TargetHumanoid] = true
							end   	
						end
					end
				elseif HitPart.Name == "_glass" then
					ShatterGlass:FireServer(HitPart, HitPart.Position, direction)
		    	end
			end
	    end)
	end
end

local function CanRayPenetrate(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, hitData)
	-- This function shows off the penetrating feature. Pass this function as the last argument (after bulletAcceleration) and it will run this every time the ray runs into an object
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart ~= nil and hitPart.Parent ~= nil then
		if hitData[6] ~= nil and hitPart.Name == "_glass" then
			ShatterGlass:FireServer(hitPart, hitPoint, direction)
			return "penetratedObject" -- Penetrate Object
		else
			local Distance = (hitPoint - origin).Magnitude
			local Target = hitPart:FindFirstAncestorOfClass("Model")
			local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
			local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
			local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
			if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
				if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
				if hitData[6] ~= nil then
					if TargetHumanoid.Health > 0 then
						Thread:Spawn(function()
							InflictTarget:InvokeServer(hitData[7], hitData[5],
		                    	Tagger,
		                      	TargetHumanoid,
				               	TargetTorso,
								{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
				               	{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
				               	{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
				               	hitPart,
				               	{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
						end)
						if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
							hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
						end  
					end
				end
				return "penetratedHumanoid" -- Penetrate Humanoid
		  	else
		   		if ShowEffects then MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6]) end
				return "penetratedObject" -- Penetrate Object
		   	end
		end
	end
end

local function CanRayPenetrateHumanoid(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, penetrationAmount, hitData)
	-- This function shows off the penetrating feature. Pass this function as the last argument (after bulletAcceleration) and it will run this every time the ray runs into an object
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart ~= nil and hitPart.Parent ~= nil then
		if (hitPart.Transparency > 0.75
			or hitPart.Name == "Handle"
			or hitPart.Name == "Effect"
			or hitPart.Name == "Bullet"
			or hitPart.Name == "Laser"
			or string.lower(hitPart.Name) == "water"
			or hitPart.Name == "Rail"
			or hitPart.Name == "Arrow"
			or (hitPart.Parent:FindFirstChild("Humanoid") and hitPart.Parent.Humanoid.Health == 0)) then
			return true -- Penetrate Blacklisted Object
		else
			local Distance = (hitPoint - origin).Magnitude
			local Target = hitPart:FindFirstAncestorOfClass("Model")
			local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
			local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
			local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
			if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
				if penetrationAmount > 0 then
					if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
					if hitData[6] ~= nil then
						if TargetHumanoid.Health > 0 then
							Thread:Spawn(function()
								InflictTarget:InvokeServer(hitData[7], hitData[5],
			                   		Tagger,
			                  		TargetHumanoid,
				                	TargetTorso,
									{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
				                	{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
				                	{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
				                	hitPart,
				                	{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
							end)
							if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
								hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
							end  
						end
					end
				end
				return true -- Penetrate Humanoid
			--[[else
				-- We must check if penetrationAmount reachs 0
				if penetrationAmount <= 0 then
			   		MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6])
				end]]
			end
		end
	end
	return false -- Can't penetrate
end

local function OnRayExited(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, hitData)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart.Name == "_glass" then
		return
	else
		local Target = hitPart:FindFirstAncestorOfClass("Model")
		local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
		local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
		if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
			if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
		else
		   	if ShowEffects then MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6]) end
		end
	end
end

local function OnRayUpdated(castOrigin, segmentOrigin, segmentDirection, length, segmentVelocity, cosmeticBulletObject, bulletData, whizData, hitData)
	-- Whenever the caster steps forward by one unit, this function is called
	-- The bullet argument is the same object passed into the fire function
	local bulletLength = cosmeticBulletObject.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
	local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
	if bulletData[1] then
		cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength)) * CFrame.Angles(math.rad(-360 * (os.clock() * bulletData[2] - math.floor(os.clock() * bulletData[2]))), math.rad(-360 * (os.clock() * bulletData[3] - math.floor(os.clock() * bulletData[3]))), math.rad(-360 * (os.clock() * bulletData[4] - math.floor(os.clock() * bulletData[4]))))
	else
		cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
	end
	if hitData[6] == nil and whizData[1] and cosmeticBulletObject.Parent and cosmeticBulletObject:FindFirstChild("Whizzed") then
		local Whizzed = cosmeticBulletObject:FindFirstChild("Whizzed")
		if not Whizzed.Value then	
	   		local Mag = (Camera.CFrame.p - cosmeticBulletObject.Position).Magnitude		
			if Mag < whizData[5] then
				--local Loudness = 1 - (mag / whizData[5])
				local WhizSound = Instance.new("Sound")
				WhizSound.SoundId = "rbxassetid://"..whizData[2][math.random(1, #whizData[2])]
				WhizSound.Volume = whizData[6] --Loudness
				WhizSound.PlaybackSpeed = Random.new():NextNumber(whizData[3], whizData[4])
				WhizSound.Name = "WhizSound"
				WhizSound.Parent = SoundService				
				WhizSound:Play()
				Debris:AddItem(WhizSound, WhizSound.TimeLength / WhizSound.PlaybackSpeed)
				Whizzed.Value = true
			end
		end
	end
end

function ProjectileHandler:VisualizeHitEffect(Type, Replicate, Hit, Position, Normal, Material, ...)
	if Replicate then 
		VisualizeHitEffect:FireServer(Type, nil, Hit, Position, Normal, Material, ...)
	end
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Camera.CFrame.p).Magnitude <= RenderDistance) or (Position - Camera.CFrame.p).Magnitude <= RenderDistance
	if ShowEffects then
		if Type == "Normal" then
			MakeImpactFX(Hit, Position, Normal, Material, ...)
		elseif Type == "Blood" then
			MakeBloodFX(Hit, Position, Normal, Material, ...)
		end
	end
end

function ProjectileHandler:SimulateProjectile(Module, Tool, Handle, Directions, FirePointObject, HitEffectData, BloodEffectData, BulletHoleData, ExplosiveData, BulletData, WhizData, ClientData)
	if Module and Tool and Handle then
		if ClientData ~= nil then 
			VisualizeBullet:FireServer(Module, Tool, Handle, Directions, FirePointObject, HitEffectData, BloodEffectData, BulletHoleData, ExplosiveData, BulletData, WhizData, nil)
		end
		for _, Direction in pairs(Directions) do
			local Origin, Dir = FirePointObject.WorldPosition, Direction

            if FirePointObject ~= nil then
                local TipCFrame = FirePointObject.WorldCFrame
				local TipPos = TipCFrame.Position
				local TipDir = TipCFrame.LookVector
				local AmountToCheatBack = math.abs((Tool.Parent:FindFirstChild("HumanoidRootPart").Position - TipPos):Dot(TipDir)) + 1
				local gunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
                local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(gunRay, {Handle, Tool.Parent, Camera}, false, true)
				if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
					Origin = HitPoint - TipDir.Unit * 0.1
                    --Dir = TipDir.Unit
                end
            end

			local HumanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart", 1)
			local MyMovementSpeed = HumanoidRootPart.Velocity
			local ModifiedBulletSpeed = (Dir * BulletData[2]) -- + MyMovementSpeed
	
			local Bullet = Projectiles[BulletData[1]]:Clone()
			Bullet.CFrame = CFrame.new(Origin, Origin + Dir)
			Bullet.Parent = Camera

			local Whizzed = Instance.new("BoolValue")
			Whizzed.Name = "Whizzed"
			Whizzed.Value = false
			Whizzed.Parent = Bullet

			for _, v in pairs(Bullet:GetDescendants()) do
				if v:IsA("ParticleEmitter") then
					v.Enabled = true
				elseif v:IsA("Sound") then
					v:Play()
				elseif v:IsA("PointLight") then
					v.Enabled = true
				elseif v:IsA("Trail") then
					v.Enabled = true
				elseif v:IsA("Beam") then
					v.Enabled = true
				end
			end
	
			if ClientData ~= nil then 
				if (BulletData[10] > 0 or BulletData[11] > 0) and not ExplosiveData[1] then
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool,
						{{ClientData[1][1], ClientData[1][2], ClientData[1][3], ClientData[1][4], ClientData[1][5], ClientData[1][6], ClientData[1][7]},
	                	{ClientData[2][1], ClientData[2][2], ClientData[2][3], ClientData[2][4], ClientData[2][5], ClientData[2][6], ClientData[2][7], ClientData[2][8]},
	                	{ClientData[3][1], ClientData[3][2], ClientData[3][3]},
	                	{ClientData[4][1], ClientData[4][2], ClientData[4][3], ClientData[4][4], ClientData[4][5], ClientData[4][6], ClientData[4][7]}},
						Module}, 
						{penetrationType = BulletData[5], penetrationDepth = BulletData[10], canPenetrateFunction = CanRayPenetrate, penetrationAmount = BulletData[11], canPenetrateHumanoidFunction = CanRayPenetrateHumanoid})
				else
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool,
						{{ClientData[1][1], ClientData[1][2], ClientData[1][3], ClientData[1][4], ClientData[1][5], ClientData[1][6], ClientData[1][7]},
	                	{ClientData[2][1], ClientData[2][2], ClientData[2][3], ClientData[2][4], ClientData[2][5], ClientData[2][6], ClientData[2][7], ClientData[2][8]},
	                	{ClientData[3][1], ClientData[3][2], ClientData[3][3]},
	                	{ClientData[4][1], ClientData[4][2], ClientData[4][3], ClientData[4][4], ClientData[4][5], ClientData[4][6], ClientData[4][7]}},
						Module},
						nil)
				end
			else
				if (BulletData[10] > 0 or BulletData[11] > 0) and not ExplosiveData[1] then
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool, nil, Module},
						{penetrationType = BulletData[5], penetrationDepth = BulletData[10], canPenetrateFunction = CanRayPenetrate, penetrationAmount = BulletData[11], canPenetrateHumanoidFunction = CanRayPenetrateHumanoid})
				else
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool, nil, Module},
						nil)
				end
			end
		end
	end
end

Caster.LengthChanged:Connect(OnRayUpdated)
Caster.RayHit:Connect(OnRayHit)
Caster.RayExited:Connect(OnRayExited)

return ProjectileHandler
