local u=false local k=400 local F=true local c=16 FastCast.DebugLogging=false FastCast.VisualizeCasts=false FastCast.RayExit=true local b=Instance.new("\066\101\097\109")b.TextureSpeed=0 b.LightEmission=0 b.LightInfluence=1 b.Transparency=NumberSequence.new(0)local e=FastCast.new()local function i(u,k,F,c)if F~=nil and(u and k)then return k==1 and F.Level1 or k==2 and F.Level2 or k==3 and F.Level3 or c else return c end end local function J(k,F,c,e,J,y,s,m,T)local C=CFrame.new(F,F+c)local O=y.HitEffectEnabled local z=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitSoundIDs,y.HitSoundIDs)local r=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitSoundPitchMin,y.HitSoundPitchMin)local P=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitSoundPitchMax,y.HitSoundPitchMax)local V=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitSoundVolume,y.HitSoundVolume)local R=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.CustomHitEffect,y.CustomHitEffect)local p=y.BulletHoleEnabled local H=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BulletHoleSize,y.BulletHoleSize)local w=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BulletHoleTexture,y.BulletHoleTexture)local M=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.PartColor,y.PartColor)local d=y.BulletHoleVisibleTime local t=y.BulletHoleFadeTime if T then O=y.MeleeHitEffectEnabled z=y.MeleeHitSoundIDs r=y.MeleeHitSoundPitchMin P=y.MeleeHitSoundPitchMax V=y.MeleeHitSoundVolume R=y.CustomMeleeHitEffect p=y.MarkerEffectEnabled H=y.MarkerEffectSize w=y.MarkerEffectTexture d=y.MarkerEffectVisibleTime t=y.MarkerEffectFadeTime M=y.MarkerPartColor end if O then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.CFrame=C F.Parent=Workspace.Terrain local c local function i(i)if s.HitEffectFolder[i.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\083\111\117\110\100\115")then local u=s.HitEffectFolder[i.Name].MaterialSounds:GetChildren()local k=math.random(1,#u)local b=u[k]if b~=nil then c=b:Clone()if b:FindFirstChild("\080\105\116\099\104")then c.PlaybackSpeed=(Random.new()):NextNumber(b.Pitch.Min.Value,b.Pitch.Max.Value)else c.PlaybackSpeed=(Random.new()):NextNumber(r,P)end if b:FindFirstChild("\086\111\108\117\109\101")then c.Volume=(Random.new()):NextNumber(b.Volume.Min.Value,b.Volume.Max.Value)else c.Volume=V end c.Parent=F end else c=Instance.new("\083\111\117\110\100",F)c.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..z[math.random(1,#z)]c.PlaybackSpeed=(Random.new()):NextNumber(r,P)c.Volume=V end for c,b in pairs(s.HitEffectFolder[i.Name]:GetChildren())do if b.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local c=1 local i=b:Clone()i.Parent=F if i:FindFirstChild("\069\109\105\116\067\111\117\110\116")then c=i.EmitCount.Value end if i.PartColor.Value then local u=k and k.Color or Color3.fromRGB(255,255,255)if k and k:IsA("\084\101\114\114\097\105\110")then u=Workspace.Terrain:GetMaterialColor(e or Enum.Material.Sand)end i.Color=ColorSequence.new(u,u)end Thread:Delay(.01,function()if u then local u=(UserSettings()).GameSettings.SavedQualityLevel if u==Enum.SavedQualitySetting.Automatic then local u=.5 i:Emit(c*u)else local k=u.Value/21 i:Emit(c*k)end else i:Emit(c)end Debris:AddItem(i,i.Lifetime.Max)end)end end c:Play()if p then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.Parent=J and k or Workspace.Terrain F.WorldCFrame=C*CFrame.Angles(math.rad(90),math.rad(180),0)if J then local c=H if s.HitEffectFolder[i.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\072\111\108\101\083\105\122\101")then c=s.HitEffectFolder[i.Name].MaterialHoleSize.Value end local J=Instance.new("\065\116\116\097\099\104\109\101\110\116")local y=Instance.new("\065\116\116\097\099\104\109\101\110\116")local T=b:Clone()T.Width0=c T.Width1=c if s.HitEffectFolder[i.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\068\101\099\097\108\115")then local u=s.HitEffectFolder[i.Name].MaterialDecals:GetChildren()local F=math.random(1,#u)local c=u[F]if c~=nil then T.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..c.Value if c.PartColor.Value then local u=k and k.Color or Color3.fromRGB(255,255,255)if k and k:IsA("\084\101\114\114\097\105\110")then u=Workspace.Terrain:GetMaterialColor(e or Enum.Material.Sand)end T.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,u),ColorSequenceKeypoint.new(1,u)})end end else T.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..w[math.random(1,#w)]if M then local u=k and k.Color or Color3.fromRGB(255,255,255)if k and k:IsA("\084\101\114\114\097\105\110")then u=Workspace.Terrain:GetMaterialColor(e or Enum.Material.Sand)end T.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,u);ColorSequenceKeypoint.new(1,u)})end end T.Attachment0=J T.Attachment1=y J.Parent=k y.Parent=k J.WorldCFrame=(F.WorldCFrame*CFrame.new(c/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)y.WorldCFrame=(F.WorldCFrame*CFrame.new(-c/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)T.Parent=Workspace.Terrain Thread:Delay(d,function()if d>0 then if u then if m then local u=os.clock()while F~=nil do local k=math.min((os.clock()-u)/t,1)if T then T.Transparency=NumberSequence.new(Math.Lerp(0,1,k))end if k==1 then break end Thread:Wait()end if J then J:Destroy()end if y then y:Destroy()end if T then T:Destroy()end if F then F:Destroy()end else if J then J:Destroy()end if y then y:Destroy()end if T then T:Destroy()end if F then F:Destroy()end end else local u=os.clock()while F~=nil do local k=math.min((os.clock()-u)/t,1)if T then T.Transparency=NumberSequence.new(Math.Lerp(0,1,k))end if k==1 then break end Thread:Wait()end if J then J:Destroy()end if y then y:Destroy()end if T then T:Destroy()end if F then F:Destroy()end end else if J then J:Destroy()end if y then y:Destroy()end if T then T:Destroy()end if F then F:Destroy()end end end)else Debris:AddItem(F,5)end end end if not R then if s.HitEffectFolder:FindFirstChild(k.Material)then i(k.Material)else i(s.HitEffectFolder.Custom)end else i(s.HitEffectFolder.Custom)end Debris:AddItem(F,10)end end local function y(k,F,c,e,J,y,s,m,T)local C=CFrame.new(F,F+c)local O=y.BloodEnabled local z=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitCharSndIDs,y.HitCharSndIDs)local r=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitCharSndPitchMin,y.HitCharSndPitchMin)local P=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitCharSndPitchMax,y.HitCharSndPitchMax)local V=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.HitCharSndVolume,y.HitCharSndVolume)local R=y.BloodWoundEnabled local p=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BloodWoundTexture,y.BloodWoundTexture)local H=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BloodWoundSize,y.BloodWoundSize)local w=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BloodWoundTextureColor,y.BloodWoundTextureColor)local M=i(y.ChargedShotAdvanceEnabled,s.ChargeLevel,y.ChargeAlterTable.BloodWoundPartColor,y.BloodWoundPartColor)local d=y.BloodWoundVisibleTime local t=y.BloodWoundFadeTime if T then O=y.MeleeBloodEnabled z=y.MeleeHitCharSndIDs r=y.MeleeHitCharSndPitchMin P=y.MeleeHitCharSndPitchMax V=y.MeleeHitCharSndVolume R=y.MeleeBloodWoundEnabled p=y.MeleeBloodWoundSize H=y.MeleeBloodWoundTexture w=y.MeleeBloodWoundTextureColor M=y.MeleeBloodWoundVisibleTime d=y.MeleeBloodWoundFadeTime t=y.MeleeBloodWoundPartColor end if O then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.CFrame=C F.Parent=Workspace.Terrain local c=Instance.new("\083\111\117\110\100")c.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..z[math.random(1,#z)]c.PlaybackSpeed=(Random.new()):NextNumber(r,P)c.Volume=V c.Parent=F for k,c in pairs(s.BloodEffectFolder:GetChildren())do if c.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local k=1 local b=c:Clone()b.Parent=F if b:FindFirstChild("\069\109\105\116\067\111\117\110\116")then k=b.EmitCount.Value end Thread:Delay(.01,function()if u then local u=(UserSettings()).GameSettings.SavedQualityLevel if u==Enum.SavedQualitySetting.Automatic then local u=.5 b:Emit(k*u)else local F=u.Value/21 b:Emit(k*F)end else b:Emit(k)end Debris:AddItem(b,b.Lifetime.Max)end)end end c:Play()Debris:AddItem(F,10)if R then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.Parent=J and k or Workspace.Terrain F.WorldCFrame=C*CFrame.Angles(math.rad(90),math.rad(180),0)if J then local c=Instance.new("\065\116\116\097\099\104\109\101\110\116")local i=Instance.new("\065\116\116\097\099\104\109\101\110\116")local J=b:Clone()J.Width0=H J.Width1=H J.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..p[math.random(1,#p)]J.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,w),ColorSequenceKeypoint.new(1,w)})if M then local u=k and k.Color or Color3.fromRGB(255,255,255)if k and k:IsA("\084\101\114\114\097\105\110")then u=Workspace.Terrain:GetMaterialColor(e or Enum.Material.Sand)end J.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,u),ColorSequenceKeypoint.new(1,u)})end J.Attachment0=c J.Attachment1=i c.Parent=k i.Parent=k c.WorldCFrame=(F.WorldCFrame*CFrame.new(H/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)i.WorldCFrame=(F.WorldCFrame*CFrame.new(-H/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)J.Parent=Workspace.Terrain Thread:Delay(d,function()if d>0 then if u then if m then local u=os.clock()while F~=nil do local k=math.min((os.clock()-u)/t,1)if J then J.Transparency=NumberSequence.new(Math.Lerp(0,1,k))end if k==1 then break end Thread:Wait()end if c then c:Destroy()end if i then i:Destroy()end if J then J:Destroy()end if F then F:Destroy()end else if c then c:Destroy()end if i then i:Destroy()end if J then J:Destroy()end if F then F:Destroy()end end else local u=os.clock()while F~=nil do local k=math.min((os.clock()-u)/t,1)if J then J.Transparency=NumberSequence.new(Math.Lerp(0,1,k))end if k==1 then break end Thread:Wait()end if c then c:Destroy()end if i then i:Destroy()end if J then J:Destroy()end if F then F:Destroy()end end else if c then c:Destroy()end if i then i:Destroy()end if J then J:Destroy()end if F then F:Destroy()end end end)else Debris:AddItem(F,5)end end end end local function s(b,e,s,m,T,C,O,z,r,P,V,R)local p=F and(ScreenCulling(C,c)and(C-Camera.CFrame.p).Magnitude<=k)or(C-Camera.CFrame.p).Magnitude<=k e.Transparency=1 for u,k in pairs(e:GetDescendants())do if k:IsA("\066\097\115\101\080\097\114\116")or k:IsA("\068\101\099\097\108")or k:IsA("\084\101\120\116\117\114\101")then k.Transparency=1 elseif k:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then k.Enabled=false elseif k:IsA("\083\111\117\110\100")then k:Stop()elseif k:IsA("\080\111\105\110\116\076\105\103\104\116")then k.Enabled=false elseif k:IsA("\066\101\097\109")then k.Enabled=false end end Debris:AddItem(e,5)if not i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosiveEnabled,P.ExplosiveEnabled)then if T and T.Parent then if T.Name=="\095\103\108\097\115\115"then if R then ShatterGlass:FireServer(T,C,m)end else local u=(C-s).Magnitude local k=T:FindFirstAncestorOfClass("\077\111\100\101\108")local F=k and k:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local c=k and(k:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or k:FindFirstChild("\072\101\097\100"))if F and(F.Health>0 and c)then if p then y(T,C,O,z,true,P,V,R)end if R then if F.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",r,P,F,c,T,V,u)end)if r and r.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then r.GunClient.MarkerEvent:Fire(P,T.Name=="\072\101\097\100"and P.HeadshotEnabled)end end end else if p then J(T,C,O,z,true,P,V,R)end end end end else if P.ExplosionSoundEnabled then local u=i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionSoundIDs,P.ExplosionSoundIDs)local k=Instance.new("\065\116\116\097\099\104\109\101\110\116")k.CFrame=CFrame.new(C)k.Parent=Workspace.Terrain local F=Instance.new("\083\111\117\110\100")F.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..u[math.random(1,#u)]F.PlaybackSpeed=(Random.new()):NextNumber(i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionSoundPitchMin,P.ExplosionSoundPitchMin),i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionSoundPitchMax,P.ExplosionSoundPitchMax))F.Volume=i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionSoundVolume,P.ExplosionSoundVolume)F.Parent=k F:Play()Debris:AddItem(k,10)end local k=Instance.new("\069\120\112\108\111\115\105\111\110")k.BlastRadius=i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionRadius,P.ExplosionRadius)k.BlastPressure=0 k.ExplosionType=Enum.ExplosionType.NoCraters k.Position=C k.Parent=Camera local F=CFrame.new(C,C+O)if P.CustomExplosion then k.Visible=false if p then local k=Instance.new("\065\116\116\097\099\104\109\101\110\116")k.CFrame=F k.Parent=Workspace.Terrain for F,c in pairs(V.ExplosionEffectFolder:GetChildren())do if c.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local F=1 local b=c:Clone()b.Parent=k if b:FindFirstChild("\069\109\105\116\067\111\117\110\116")then F=b.EmitCount.Value end Thread:Delay(.01,function()if u then local u=(UserSettings()).GameSettings.SavedQualityLevel if u==Enum.SavedQualitySetting.Automatic then local u=.5 b:Emit(F*u)else local k=u.Value/21 b:Emit(F*k)end else b:Emit(F)end Debris:AddItem(b,b.Lifetime.Max)end)end end Debris:AddItem(k,10)end end local c={}k.Hit:Connect(function(u,F)if u and R then if u.Parent and u.Name=="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"or u.Name=="\072\101\097\100"then local b=u:FindFirstAncestorOfClass("\077\111\100\101\108")local e=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"))if e then if e.Health>0 then if not c[e]then if P.ExplosionKnockback then local u=i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget,P.ExplosionKnockbackMultiplierOnTarget)local c=F/i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionRadius,P.ExplosionRadius)c=1-c local y=(J.Position-k.Position).Unit*i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionKnockbackPower,P.ExplosionKnockbackPower)local s=(J.Velocity-Vector3.new(0,J.Velocity.y,0))+Vector3.new(y.X,0,y.Z)if DamageModule.CanDamage(b,r.Parent,P.FriendlyFire)then local k=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")k.MaxForce=Vector3.new(math.huge,0,math.huge)k.Velocity=s k.Parent=J J.Velocity=J.Velocity+Vector3.new(0,y.Y*u,0)Debris:AddItem(k,.25)else if e.Parent.Name==Player.Name then u=i(P.ChargedShotAdvanceEnabled,V.ChargeLevel,P.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer,P.ExplosionKnockbackMultiplierOnPlayer)local k=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")k.MaxForce=Vector3.new(math.huge,0,math.huge)k.Velocity=s k.Parent=J J.Velocity=J.Velocity+Vector3.new(0,y.Y*u,0)Debris:AddItem(k,.25)end end end Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",r,P,e,J,T,V,F)end)if r and r.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then r.GunClient.MarkerEvent:Fire(P,T.Name=="\072\101\097\100"and P.HeadshotEnabled)end c[e]=true end end end elseif u.Name=="\095\103\108\097\115\115"then ShatterGlass:FireServer(u,u.Position,m)end end end)end end local function m(u,b,e,i,s,m,T,C,O,z,r)local P=F and(ScreenCulling(s,c)and(s-Workspace.CurrentCamera.CFrame.p).Magnitude<=k)or(s-Workspace.CurrentCamera.CFrame.p).Magnitude<=k if i and i.Parent then if i.Name=="\095\103\108\097\115\115"then if r then ShatterGlass:FireServer(i,s,e)end return"\112\101\110\101\116\114\097\116\101\100\079\098\106\101\099\116"else local u=(s-b).Magnitude local k=i:FindFirstAncestorOfClass("\077\111\100\101\108")local F=k and k:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local c=k and(k:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or k:FindFirstChild("\072\101\097\100"))if F and(F.Health>0 and c)then if P then y(i,s,m,T,true,O,z,r)end if r then if F.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",C,O,F,c,i,z,u)end)if C and C.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then C.GunClient.MarkerEvent:Fire(O,i.Name=="\072\101\097\100"and O.HeadshotEnabled)end end end return"\112\101\110\101\116\114\097\116\101\100\072\117\109\097\110\111\105\100"else if P then J(i,s,m,T,true,O,z,r)end return"\112\101\110\101\116\114\097\116\101\100\079\098\106\101\099\116"end end end end local function T(u,b,e,i,J,s,m,T,C,O,z,r)local P=F and(ScreenCulling(s,c)and(s-Workspace.CurrentCamera.CFrame.p).Magnitude<=k)or(s-Workspace.CurrentCamera.CFrame.p).Magnitude<=k if J and J.Parent then local u=J:FindFirstAncestorOfClass("\077\111\100\101\108")local k=u and u:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if J.Transparency>.75 or J.Name=="\077\105\115\115\105\108\101"or J.Name=="\072\097\110\100\108\101"or J.Name=="\069\102\102\101\099\116"or J.Name=="\066\117\108\108\101\116"or J.Name=="\076\097\115\101\114"or string.lower(J.Name)=="\119\097\116\101\114"or J.Name=="\082\097\105\108"or J.Name=="\065\114\114\111\119"or k and(k.Health==0 or not DamageModule.CanDamage(u,C.Parent,O.FriendlyFire))then return true else local F=(s-e).Magnitude local c=u and(u:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or u:FindFirstChild("\072\101\097\100"))if k and(k.Health>0 and c)then if b>0 then if P then y(J,s,m,T,true,O,z,r)end if r then if k.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",C,O,k,c,J,z,F)end)if C and C.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then C.GunClient.MarkerEvent:Fire(O,J.Name=="\072\101\097\100"and O.HeadshotEnabled)end end end return true end end end end return false end local function C(u,b,e,i,s,m,T,C,O,z,r)local P=F and(ScreenCulling(s,c)and(s-Camera.CFrame.p).Magnitude<=k)or(s-Camera.CFrame.p).Magnitude<=k if i and i.Parent then if i.Name=="\095\103\108\097\115\115"then return else local u=i:FindFirstAncestorOfClass("\077\111\100\101\108")local k=u and u:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local F=u and(u:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or u:FindFirstChild("\072\101\097\100"))if k and(k.Health>0 and F)then if P then y(i,s,m,T,true,O,z,r)end else if P then J(i,s,m,T,true,O,z,r)end end end end end local function O(u,k,F,c,b,e,i,J)local y=e.Size.Z/2 local s=CFrame.new(k,k+F)if i.CanSpinPart then e.CFrame=(s*CFrame.new(0,0,-(c-y)))*CFrame.Angles(math.rad(-360*(os.clock()*i.SpinX-math.floor(os.clock()*i.SpinX))),math.rad(-360*(os.clock()*i.SpinY-math.floor(os.clock()*i.SpinY))),math.rad(-360*(os.clock()*i.SpinZ-math.floor(os.clock()*i.SpinZ))))else e.CFrame=s*CFrame.new(0,0,-(c-y))end if not J and(i.WhizSoundEnabled and(e.Parent and e:FindFirstChild("\087\104\105\122\122\101\100")))then local u=e:FindFirstChild("\087\104\105\122\122\101\100")if not u.Value then local k=(Camera.CFrame.p-e.Position).Magnitude if k<i.WhizDistance then local k=Instance.new("\083\111\117\110\100")k.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..i.WhizSoundID[math.random(1,#i.WhizSoundID)]k.Volume=i.WhizSoundVolume k.PlaybackSpeed=(Random.new()):NextNumber(i.WhizSoundPitchMin,i.WhizSoundPitchMax)k.Name="\087\104\105\122\083\111\117\110\100"k.Parent=SoundService k:Play()Debris:AddItem(k,k.TimeLength/k.PlaybackSpeed)u.Value=true end end end end function ProjectileHandler.VisualizeHitEffect(O,u,b,e,i,s,m,T,C)if C then VisualizeHitEffect:FireServer(u,b,e,i,s,m,T,nil)end local z=F and(ScreenCulling(e,c)and(e-Camera.CFrame.p).Magnitude<=k)or(e-Camera.CFrame.p).Magnitude<=k if z then if u=="\078\111\114\109\097\108"then J(b,e,i,s,true,m,T,C,true)elseif u=="\066\108\111\111\100"then y(b,e,i,s,true,m,T,C,true)end end end function ProjectileHandler.SimulateProjectile(C,u,k,F,c,b,J,y,s)if F and(u and k)then if s then VisualizeBullet:FireServer(u,k,F,c,b,J,y,nil)end if F.MuzzleFlashEnabled then for u,k in pairs(y.MuzzleFolder:GetChildren())do if k.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local u=1 local F=k:Clone()F.Parent=J if F:FindFirstChild("\069\109\105\116\067\111\117\110\116")then u=F.EmitCount.Value end Thread:Delay(.01,function()F:Emit(u)Debris:AddItem(F,F.Lifetime.Max)end)end end end if F.MuzzleLightEnabled then local u=Instance.new("\080\111\105\110\116\076\105\103\104\116")u.Brightness=i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.LightBrightness,F.LightBrightness)u.Color=i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.LightColor,F.LightColor)u.Range=i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.LightRange,F.LightRange)u.Shadows=F.LightShadows u.Enabled=true u.Parent=J Debris:AddItem(u,F.VisibleTime)end for k,c in pairs(c)do if b~=nil then local k,J=b.WorldPosition,c local C={Camera;u,u.Parent}local O=u.Parent:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116",1)local z=b.WorldCFrame local r=z.Position local P=z.LookVector local V=math.abs((O.Position-r):Dot(P))+1 local R=Ray.new(r-P.Unit*V,P.Unit*V)local p,H=Workspace:FindPartOnRayWithIgnoreList(R,C,false,true)if p and math.abs((r-H).Magnitude)>0 then k=H-P.Unit*.1 end local w=O.Velocity local M=J*i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.BulletSpeed,F.BulletSpeed)local d=Projectiles[i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.ProjectileType,F.ProjectileType)]:Clone()d.CFrame=CFrame.new(k,k+J)d.Parent=Camera if not s then local u=Instance.new("\066\111\111\108\086\097\108\117\101")u.Name="\087\104\105\122\122\101\100"u.Value=false u.Parent=d end for u,k in pairs(d:GetDescendants())do if k:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then k.Enabled=true elseif k:IsA("\083\111\117\110\100")then k:Play()elseif k:IsA("\080\111\105\110\116\076\105\103\104\116")then k.Enabled=true elseif k:IsA("\084\114\097\105\108")then k.Enabled=true elseif k:IsA("\066\101\097\109")then k.Enabled=true end end local t=i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.PenetrationDepth,F.PenetrationDepth)local Z=i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.PenetrationAmount,F.PenetrationAmount)local W if(t>0 or Z>0)and not i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.ExplosiveEnabled,F.ExplosiveEnabled)then W={penetrationType=F.PenetrationType,penetrationDepth=t,canPenetrateFunction=m,penetrationAmount=Z,canPenetrateHumanoidFunction=T}end e:FireWithBlacklist(k,J*i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.Range,F.Range),M,C,d,true,i(F.ChargedShotAdvanceEnabled,y.ChargeLevel,F.ChargeAlterTable.Acceleration,F.Acceleration),u,F,y,s,W)end end end end e.LengthChanged:Connect(O)e.RayHit:Connect(s)e.RayExited:Connect(C)return ProjectileHandler

local OptimalEffects = false
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 AddressTableValue(enabled, level, v1, v2)
	if v1 ~= nil and enabled and level then
		return ((level == 1 and v1.Level1) or (level == 2 and v1.Level2) or (level == 3 and v1.Level3) or v2)
	else
		return v2
	end
end

local function MakeImpactFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
	local SurfaceCF = CFrame.new(Position, Position + Normal)
	
	local HitEffectEnabled = ClientModule.HitEffectEnabled
	local HitSoundIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundIDs, ClientModule.HitSoundIDs)
	local HitSoundPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMin, ClientModule.HitSoundPitchMin)
	local HitSoundPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMax, ClientModule.HitSoundPitchMax)
	local HitSoundVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundVolume, ClientModule.HitSoundVolume)
	local CustomHitEffect = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CustomHitEffect, ClientModule.CustomHitEffect)
	
	local BulletHoleEnabled = ClientModule.BulletHoleEnabled
	local BulletHoleSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleSize, ClientModule.BulletHoleSize)
	local BulletHoleTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleTexture, ClientModule.BulletHoleTexture)
	local PartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PartColor, ClientModule.PartColor)
	local BulletHoleVisibleTime = ClientModule.BulletHoleVisibleTime
	local BulletHoleFadeTime = ClientModule.BulletHoleFadeTime
	
	if IsMelee then
		HitEffectEnabled = ClientModule.MeleeHitEffectEnabled
		HitSoundIDs = ClientModule.MeleeHitSoundIDs
		HitSoundPitchMin = ClientModule.MeleeHitSoundPitchMin
		HitSoundPitchMax = ClientModule.MeleeHitSoundPitchMax
		HitSoundVolume = ClientModule.MeleeHitSoundVolume
		CustomHitEffect = ClientModule.CustomMeleeHitEffect
		
		BulletHoleEnabled = ClientModule.MarkerEffectEnabled
		BulletHoleSize = ClientModule.MarkerEffectSize
		BulletHoleTexture = ClientModule.MarkerEffectTexture
		BulletHoleVisibleTime = ClientModule.MarkerEffectVisibleTime
		BulletHoleFadeTime = ClientModule.MarkerEffectFadeTime
		PartColor = ClientModule.MarkerPartColor
	end
	
	if HitEffectEnabled then
		local Attachment = Instance.new("Attachment")
		Attachment.CFrame = SurfaceCF
		Attachment.Parent = Workspace.Terrain
		local Sound
		
		local function Spawner(material)
			if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialSounds") then
				local tracks = Misc.HitEffectFolder[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(HitSoundPitchMin, HitSoundPitchMax)
					end
					if track:FindFirstChild("Volume") then
						Sound.Volume = Random.new():NextNumber(track.Volume.Min.Value, track.Volume.Max.Value)
					else
						Sound.Volume = HitSoundVolume
					end
					Sound.Parent = Attachment
				end
			else
				Sound = Instance.new("Sound",Attachment)
				Sound.SoundId = "rbxassetid://"..HitSoundIDs[math.random(1, #HitSoundIDs)]
				Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
				Sound.Volume = HitSoundVolume
			end
			for i, v in pairs(Misc.HitEffectFolder[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 BulletHoleEnabled 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 = BulletHoleSize
					if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialHoleSize") then
						Scale = Misc.HitEffectFolder[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 Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialDecals") then
						local Decals = Misc.HitEffectFolder[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://"..BulletHoleTexture[math.random(1, #BulletHoleTexture)]
						if PartColor 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(BulletHoleVisibleTime, function()
						if BulletHoleVisibleTime > 0 then
							if OptimalEffects then
								if Replicate then
									local t0 = os.clock()
									while Hole ~= nil do
										local Alpha = math.min((os.clock() - t0) / BulletHoleFadeTime, 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) / BulletHoleFadeTime, 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 CustomHitEffect then
			if Misc.HitEffectFolder:FindFirstChild(Hit.Material) then
				Spawner(Hit.Material)
			else
				Spawner(Misc.HitEffectFolder.Custom)
			end
		else
			Spawner(Misc.HitEffectFolder.Custom)
		end
		
		Debris:AddItem(Attachment, 10)				
	end
end

local function MakeBloodFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
	local SurfaceCF = CFrame.new(Position, Position + Normal)
	
	local BloodEnabled = ClientModule.BloodEnabled
	local HitCharSndIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndIDs, ClientModule.HitCharSndIDs)
	local HitCharSndPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMin, ClientModule.HitCharSndPitchMin)
	local HitCharSndPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMax, ClientModule.HitCharSndPitchMax)
	local HitCharSndVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndVolume, ClientModule.HitCharSndVolume)
	
	local BloodWoundEnabled = ClientModule.BloodWoundEnabled
	local BloodWoundTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTexture, ClientModule.BloodWoundTexture)
	local BloodWoundSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundSize, ClientModule.BloodWoundSize)
	local BloodWoundTextureColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTextureColor, ClientModule.BloodWoundTextureColor)
	local BloodWoundPartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundPartColor, ClientModule.BloodWoundPartColor)
	local BloodWoundVisibleTime = ClientModule.BloodWoundVisibleTime
	local BloodWoundFadeTime = ClientModule.BloodWoundFadeTime
	
	if IsMelee then
		BloodEnabled = ClientModule.MeleeBloodEnabled
		HitCharSndIDs = ClientModule.MeleeHitCharSndIDs
		HitCharSndPitchMin = ClientModule.MeleeHitCharSndPitchMin
		HitCharSndPitchMax = ClientModule.MeleeHitCharSndPitchMax
		HitCharSndVolume = ClientModule.MeleeHitCharSndVolume

		BloodWoundEnabled = ClientModule.MeleeBloodWoundEnabled
		BloodWoundTexture = ClientModule.MeleeBloodWoundSize
		BloodWoundSize = ClientModule.MeleeBloodWoundTexture
		BloodWoundTextureColor = ClientModule.MeleeBloodWoundTextureColor
		BloodWoundPartColor = ClientModule.MeleeBloodWoundVisibleTime
		BloodWoundVisibleTime = ClientModule.MeleeBloodWoundFadeTime
		BloodWoundFadeTime = ClientModule.MeleeBloodWoundPartColor
	end
	
	if BloodEnabled then
		local Attachment = Instance.new("Attachment")
		Attachment.CFrame = SurfaceCF
		Attachment.Parent = Workspace.Terrain
		local Sound = Instance.new("Sound")
		Sound.SoundId = "rbxassetid://"..HitCharSndIDs[math.random(1, #HitCharSndIDs)]
		Sound.PlaybackSpeed = Random.new():NextNumber(HitCharSndPitchMin, HitCharSndPitchMax)
		Sound.Volume = HitCharSndVolume
		Sound.Parent = Attachment
		for i, v in pairs(Misc.BloodEffectFolder: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
		Sound:Play()
		Debris:AddItem(Attachment, 10)
		
		if BloodWoundEnabled 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 A0 = Instance.new("Attachment")
				local A1 = Instance.new("Attachment")
				local BeamClone = Beam:Clone()
				BeamClone.Width0 = BloodWoundSize
				BeamClone.Width1 = BloodWoundSize
				BeamClone.Texture = "rbxassetid://"..BloodWoundTexture[math.random(1, #BloodWoundTexture)]
				BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, BloodWoundTextureColor), ColorSequenceKeypoint.new(1, BloodWoundTextureColor)})
				if BloodWoundPartColor 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(BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
				A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
				BeamClone.Parent = Workspace.Terrain
				Thread:Delay(BloodWoundVisibleTime, function()
					if BloodWoundVisibleTime > 0 then
						if OptimalEffects then
							if Replicate then
								local t0 = os.clock()
								while Hole ~= nil do
									local Alpha = math.min((os.clock() - t0) / BloodWoundFadeTime, 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) / BloodWoundFadeTime, 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(SegmentVelocity, CosmeticBulletObject, Origin, Direction, Hit, Position, Normal, Material, Tool, ClientModule, Misc, Replicate)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Camera.CFrame.p).Magnitude <= RenderDistance) or (Position - 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 AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosiveEnabled, ClientModule.ExplosiveEnabled) then
		if Hit and Hit.Parent then
			if Hit.Name == "_glass" then
				if Replicate then
					ShatterGlass:FireServer(Hit, Position, Direction)
				end
			else
				local Distance = (Position - Origin).Magnitude
				local Target = Hit: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(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
					end
					if Replicate then
						if TargetHumanoid.Health > 0 then							
							Thread:Spawn(function()
								InflictTarget:InvokeServer("Gun", Tool, ClientModule, TargetHumanoid, TargetTorso, Hit, Misc, Distance)
							end)
							if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
								Tool.GunClient.MarkerEvent:Fire(ClientModule, Hit.Name == "Head" and ClientModule.HeadshotEnabled)
							end
						end
					end
				else
					if ShowEffects then
						MakeImpactFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
					end
				end				
			end
		end
	else
		if ClientModule.ExplosionSoundEnabled then
			local SoundTable = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionSoundIDs, ClientModule.ExplosionSoundIDs)
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = CFrame.new(Position)
			Attachment.Parent = Workspace.Terrain
			local Sound = Instance.new("Sound")
			Sound.SoundId = "rbxassetid://"..SoundTable[math.random(1, #SoundTable)]
			Sound.PlaybackSpeed = Random.new():NextNumber(AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionSoundPitchMin, ClientModule.ExplosionSoundPitchMin), AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionSoundPitchMax, ClientModule.ExplosionSoundPitchMax))
			Sound.Volume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionSoundVolume, ClientModule.ExplosionSoundVolume)
			Sound.Parent = Attachment
			Sound:Play()
			Debris:AddItem(Attachment, 10)		
		end

		local Explosion = Instance.new("Explosion")
		Explosion.BlastRadius = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionRadius, ClientModule.ExplosionRadius)
		Explosion.BlastPressure = 0
		Explosion.ExplosionType = Enum.ExplosionType.NoCraters
		Explosion.Position = Position
		Explosion.Parent = Camera

		local SurfaceCF = CFrame.new(Position, Position + Normal)

		if ClientModule.CustomExplosion then
			Explosion.Visible = false

			if ShowEffects then
				local Attachment = Instance.new("Attachment")
				Attachment.CFrame = SurfaceCF
				Attachment.Parent = Workspace.Terrain

				for i, v in pairs(Misc.ExplosionEffectFolder: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
				
				Debris:AddItem(Attachment, 10)
			end
		end	

		local HitHumanoids = {}

		Explosion.Hit:Connect(function(HitPart, HitDist)
			if HitPart and Replicate then
				if HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
					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 then
						if TargetHumanoid.Health > 0 then
							if not HitHumanoids[TargetHumanoid] then
								if ClientModule.ExplosionKnockback then
									local Multipler = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget, ClientModule.ExplosionKnockbackMultiplierOnTarget)
									local DistanceFactor = HitDist / AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionRadius, ClientModule.ExplosionRadius)
									DistanceFactor = 1 - DistanceFactor
									local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionKnockbackPower, ClientModule.ExplosionKnockbackPower) --* DistanceFactor
									local AirVelocity = TargetTorso.Velocity - Vector3.new(0, TargetTorso.Velocity.y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z)
									if DamageModule.CanDamage(Target, Tool.Parent, ClientModule.FriendlyFire) 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 == Player.Name then
											Multipler = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer, ClientModule.ExplosionKnockbackMultiplierOnPlayer)
											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("Gun", Tool, ClientModule, TargetHumanoid, TargetTorso, Hit, Misc, HitDist)
								end)
								if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
									Tool.GunClient.MarkerEvent:Fire(ClientModule, Hit.Name == "Head" and ClientModule.HeadshotEnabled)
								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(SegmentVelocity, Origin, Direction, Hit, Position, Normal, Material, Tool, ClientModule, Misc, Replicate)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Workspace.CurrentCamera.CFrame.p).Magnitude <= RenderDistance) or (Position - Workspace.CurrentCamera.CFrame.p).Magnitude <= RenderDistance	
	if Hit and Hit.Parent then
		if Hit.Name == "_glass" then
			if Replicate then
				ShatterGlass:FireServer(Hit, Position, Direction)
			end
			return "penetratedObject" -- Penetrate Object
		else
			local Distance = (Position - Origin).Magnitude
			local Target = Hit: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(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
				end
				if Replicate then
					if TargetHumanoid.Health > 0 then							
						Thread:Spawn(function()
							InflictTarget:InvokeServer("Gun", Tool, ClientModule, TargetHumanoid, TargetTorso, Hit, Misc, Distance)
						end)
						if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
							Tool.GunClient.MarkerEvent:Fire(ClientModule, Hit.Name == "Head" and ClientModule.HeadshotEnabled)
						end						
					end
				end
				return "penetratedHumanoid" -- Penetrate Humanoid
			else
				if ShowEffects then
					MakeImpactFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
				end
				return "penetratedObject" -- Penetrate Object
			end			
		end
	end
end

local function CanRayPenetrateHumanoid(SegmentVelocity, PenetrationAmount, Origin, Direction, Hit, Position, Normal, Material, Tool, ClientModule, Misc, Replicate)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Workspace.CurrentCamera.CFrame.p).Magnitude <= RenderDistance) or (Position - Workspace.CurrentCamera.CFrame.p).Magnitude <= RenderDistance	
	if Hit and Hit.Parent then
		local Target = Hit:FindFirstAncestorOfClass("Model")
		local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
		if (Hit.Transparency > 0.75
			or Hit.Name == "Missile"
			or Hit.Name == "Handle"
			or Hit.Name == "Effect"
			or Hit.Name == "Bullet"
			or Hit.Name == "Laser"
			or string.lower(Hit.Name) == "water"
			or Hit.Name == "Rail"
			or Hit.Name == "Arrow"
			or (TargetHumanoid and (TargetHumanoid.Health == 0 or not DamageModule.CanDamage(Target, Tool.Parent, ClientModule.FriendlyFire)))
			--[[or (Hit.Parent:FindFirstChildOfClass("Tool") or Hit.Parent.Parent:FindFirstChildOfClass("Tool"))]]) then
			return true -- Penetrate Blacklisted Object
		else
			local Distance = (Position - Origin).Magnitude
			local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
			if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
				if PenetrationAmount > 0 then
					if ShowEffects then
						MakeBloodFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
					end
					if Replicate then
						if TargetHumanoid.Health > 0 then							
							Thread:Spawn(function()
								InflictTarget:InvokeServer("Gun", Tool, ClientModule, TargetHumanoid, TargetTorso, Hit, Misc, Distance)
							end)
							if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
								Tool.GunClient.MarkerEvent:Fire(ClientModule, Hit.Name == "Head" and ClientModule.HeadshotEnabled)
							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
	end
	return false -- Can't penetrate	
end

local function OnRayExited(SegmentVelocity, Origin, Direction, Hit, Position, Normal, Material, Tool, ClientModule, Misc, Replicate)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Camera.CFrame.p).Magnitude <= RenderDistance) or (Position - Camera.CFrame.p).Magnitude <= RenderDistance
	if Hit and Hit.Parent then
		if Hit.Name == "_glass" then
			return
		else
			local Target = Hit: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(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
				end
			else
				if ShowEffects then
					MakeImpactFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate)
				end
			end				
		end	
	end
end

local function OnRayUpdated(CastOrigin, SegmentOrigin, SegmentDirection, Length, SegmentVelocity, CosmeticBulletObject, ClientModule, Replicate)
	-- 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 ClientModule.CanSpinPart then
		CosmeticBulletObject.CFrame = BaseCFrame * CFrame.new(0, 0, -(Length - BulletLength)) * CFrame.Angles(math.rad(-360 * (os.clock() * ClientModule.SpinX - math.floor(os.clock() * ClientModule.SpinX))), math.rad(-360 * (os.clock() * ClientModule.SpinY - math.floor(os.clock() * ClientModule.SpinY))), math.rad(-360 * (os.clock() * ClientModule.SpinZ - math.floor(os.clock() * ClientModule.SpinZ))))
	else
		CosmeticBulletObject.CFrame = BaseCFrame * CFrame.new(0, 0, -(Length - BulletLength))
	end
	if not Replicate and ClientModule.WhizSoundEnabled 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 < ClientModule.WhizDistance then
				--local Loudness = 1 - (mag / whizData[5])
				local WhizSound = Instance.new("Sound")
				WhizSound.SoundId = "rbxassetid://"..ClientModule.WhizSoundID[math.random(1, #ClientModule.WhizSoundID)]
				WhizSound.Volume = ClientModule.WhizSoundVolume --Loudness
				WhizSound.PlaybackSpeed = Random.new():NextNumber(ClientModule.WhizSoundPitchMin, ClientModule.WhizSoundPitchMax)
				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, Hit, Position, Normal, Material, ClientModule, Misc, Replicate)
	if Replicate then 
		VisualizeHitEffect:FireServer(Type, Hit, Position, Normal, Material, ClientModule, Misc, nil)
	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, true, ClientModule, Misc, Replicate, true)
		elseif Type == "Blood" then
			MakeBloodFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate, true)
		end
	end
end

function ProjectileHandler:SimulateProjectile(Tool, Handle, ClientModule, Directions, FirePointObject, MuzzlePointObject, Misc, Replicate)
	if ClientModule and Tool and Handle then
		if Replicate then 
			VisualizeBullet:FireServer(Tool, Handle, ClientModule, Directions, FirePointObject, MuzzlePointObject, Misc, nil)
		end

		if ClientModule.MuzzleFlashEnabled then		
			for i, v in pairs(Misc.MuzzleFolder:GetChildren()) do
				if v.ClassName == "ParticleEmitter" then
					local Count = 1
					local Particle = v:Clone()
					Particle.Parent = MuzzlePointObject
					if Particle:FindFirstChild("EmitCount") then
						Count = Particle.EmitCount.Value
					end
					Thread:Delay(0.01, function()
						Particle:Emit(Count)
						Debris:AddItem(Particle, Particle.Lifetime.Max)
					end)
				end
			end	
		end

		if ClientModule.MuzzleLightEnabled then
			local Light = Instance.new("PointLight")
			Light.Brightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightBrightness, ClientModule.LightBrightness)
			Light.Color = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightColor, ClientModule.LightColor)
			Light.Range = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightRange, ClientModule.LightRange)
			Light.Shadows = ClientModule.LightShadows
			Light.Enabled = true
			Light.Parent = MuzzlePointObject
			Debris:AddItem(Light, ClientModule.VisibleTime)
		end
		
		for _, Direction in pairs(Directions) do
			if FirePointObject ~= nil then
				local Origin, Dir = FirePointObject.WorldPosition, Direction
				local IgnoreList = {Camera, Tool, Tool.Parent}

				local HumanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart", 1)
				local TipCFrame = FirePointObject.WorldCFrame
				local TipPos = TipCFrame.Position
				local TipDir = TipCFrame.LookVector
				local AmountToCheatBack = math.abs((HumanoidRootPart.Position - TipPos):Dot(TipDir)) + 1
				local GunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
				local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(GunRay, IgnoreList, false, true)
				if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
					Origin = HitPoint - TipDir.Unit * 0.1
					--Dir = TipDir.Unit
				end
				
				local MyMovementSpeed = HumanoidRootPart.Velocity
				local ModifiedBulletSpeed = (Dir * AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSpeed, ClientModule.BulletSpeed)) -- + MyMovementSpeed

				local Bullet = Projectiles[AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ProjectileType, ClientModule.ProjectileType)]:Clone()
				Bullet.CFrame = CFrame.new(Origin, Origin + Dir)
				Bullet.Parent = Camera
				
				if not Replicate then
					local Whizzed = Instance.new("BoolValue")
					Whizzed.Name = "Whizzed"
					Whizzed.Value = false
					Whizzed.Parent = Bullet					
				end

				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
				
				local PenetrationDepth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationDepth, ClientModule.PenetrationDepth)
				local PenetrationAmount = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationAmount, ClientModule.PenetrationAmount)
				local PenetrationData
				if (PenetrationDepth > 0 or PenetrationAmount > 0) and not AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExplosiveEnabled, ClientModule.ExplosiveEnabled) then
					PenetrationData = {penetrationType = ClientModule.PenetrationType, penetrationDepth = PenetrationDepth, canPenetrateFunction = CanRayPenetrate, penetrationAmount = PenetrationAmount, canPenetrateHumanoidFunction = CanRayPenetrateHumanoid}
				end
				Caster:FireWithBlacklist(Origin,
					Dir * AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Range, ClientModule.Range),
					ModifiedBulletSpeed,
					IgnoreList,
					Bullet,
					true,
					AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Acceleration, ClientModule.Acceleration),
					Tool,
					ClientModule,
					Misc,
					Replicate,
					PenetrationData)		
			end
		end
	end
end

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

return ProjectileHandler
