local X=false local F=400 local E=true local W=100 local k=true FastCast.DebugLogging=false FastCast.VisualizeCasts=false local S=Instance.new("\066\101\097\109")S.TextureSpeed=0 S.LightEmission=0 S.LightInfluence=1 S.Transparency=NumberSequence.new(0)local G=Instance.new("\070\111\108\100\101\114")G.Name="\066\108\111\099\107\083\101\103\067\111\110\116\097\105\110\101\114"G.Parent=Camera local d=Instance.new("\070\111\108\100\101\114")d.Name="\067\121\108\105\110\100\101\114\083\101\103\067\111\110\116\097\105\110\101\114"d.Parent=Camera local O=Instance.new("\070\111\108\100\101\114")O.Name="\067\111\110\101\083\101\103\067\111\110\116\097\105\110\101\114"O.Parent=Camera local P=FastCast.new()local I=PartCache.new(Miscs.BlockSegment,500)I:SetCacheParent(G)local p=PartCache.new(Miscs.CylinderSegment,500)p:SetCacheParent(d)local u=PartCache.new(Miscs.ConeSegment,500)u:SetCacheParent(O)local x=0 local Q=0 local B={}local function H(X,F,E,W,k)local S=Ray.new(F,E)local G,d,O,P=nil,F+E,Vector3.new(0,1,0),Enum.Material.Air local I=false repeat G,d,O,P=Workspace:FindPartOnRayWithIgnoreList(S,W,false,k)if G then local F=G:FindFirstAncestorOfClass("\077\111\100\101\108")local E=F and F:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local k=G:FindFirstAncestorOfClass("\084\111\111\108")if G.Transparency>.75 or G.Name=="\077\105\115\115\105\108\101"or G.Name=="\072\097\110\100\108\101"or G.Name=="\069\102\102\101\099\116"or G.Name=="\066\117\108\108\101\116"or G.Name=="\076\097\115\101\114"or string.lower(G.Name)=="\119\097\116\101\114"or G.Name=="\082\097\105\108"or G.Name=="\065\114\114\111\119"or E and(E.Health<=0 or not DamageModule.CanDamage(F,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)or X.UserData.BounceData and table.find(X.UserData.BounceData.BouncedHumanoids,E))or k then table.insert(W,G)I=false else I=true end else I=true end until I return G,d,O,P end local function T(X,F,E,W)if E~=nil and(X and F)then return F==1 and E.Level1 or F==2 and E.Level2 or F==3 and E.Level3 or W else return W end end local function j(X)if E then local E,W=Camera:WorldToScreenPoint(X)return W and(X-Camera.CFrame.p).Magnitude<=F end return(X-Camera.CFrame.p).Magnitude<=F end local function w(X,F)if F.ClassName=="\072\117\109\097\110\111\105\100"then if DamageModule.CanDamage(F.Parent,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)then table.insert(Humanoids,F)end end for F,E in ipairs(F:GetChildren())do w(X,E)end end local function K(X,F)Humanoids={}w(X,Workspace)local E=X.UserData.HomeData.HomingDistance local W=nil local k=nil local S=nil for G,d in ipairs(Humanoids)do local O=d.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or d.Parent:FindFirstChild("\084\111\114\115\111")or d.Parent:FindFirstChild("\085\112\112\101\114\084\111\114\115\111")if d and O then if(O.Position-F).Magnitude<E+O.Size.Magnitude/2.5 and d.Health>0 then if not X.UserData.HomeData.HomeThroughWall then local G,P,I,p=H(X,F,(O.CFrame.p-F).Unit*999,X.UserData.IgnoreList,true)if G then if G:IsDescendantOf(d.Parent)then if DamageModule.CanDamage(d.Parent,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)then W=d.Parent k=d S=O E=(F-O.Position).Magnitude end end end else if DamageModule.CanDamage(d.Parent,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)then W=d.Parent k=d S=O E=(F-O.Position).Magnitude end end end end end return W,k,S end local function v(F,E)if X then local X=(UserSettings()).GameSettings.SavedQualityLevel if X==Enum.SavedQualitySetting.Automatic then local X=.5 F:Emit(E*X)else local W=X.Value/21 F:Emit(E*W)end else F:Emit(E)end end local function U(F,E,W,k,S,G)if S>0 then if X then if G then local X=os.clock()while k~=nil do local F=math.min((os.clock()-X)/S,1)if W then W.Transparency=NumberSequence.new(Math.Lerp(0,1,F))end if F==1 then break end Thread:Wait()end if F then F:Destroy()end if E then E:Destroy()end if W then W:Destroy()end if k then k:Destroy()end else if F then F:Destroy()end if E then E:Destroy()end if W then W:Destroy()end if k then k:Destroy()end end else local X=os.clock()while k~=nil do local F=math.min((os.clock()-X)/S,1)if W then W.Transparency=NumberSequence.new(Math.Lerp(0,1,F))end if F==1 then break end Thread:Wait()end if F then F:Destroy()end if E then E:Destroy()end if W then W:Destroy()end if k then k:Destroy()end end else if F then F:Destroy()end if E then E:Destroy()end if W then W:Destroy()end if k then k:Destroy()end end end local function b(X,F,E,W,k,G,d,O,P)local I=CFrame.new(F,F+E)local p=G.HitEffectEnabled local u=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitSoundIDs,G.HitSoundIDs)local x=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitSoundPitchMin,G.HitSoundPitchMin)local Q=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitSoundPitchMax,G.HitSoundPitchMax)local B=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitSoundVolume,G.HitSoundVolume)local H=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.CustomHitEffect,G.CustomHitEffect)local j=G.BulletHoleEnabled local w=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BulletHoleSize,G.BulletHoleSize)local K=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BulletHoleTexture,G.BulletHoleTexture)local b=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.PartColor,G.PartColor)local z=G.BulletHoleVisibleTime local M=G.BulletHoleFadeTime if P then p=G.MeleeHitEffectEnabled u=G.MeleeHitSoundIDs x=G.MeleeHitSoundPitchMin Q=G.MeleeHitSoundPitchMax B=G.MeleeHitSoundVolume H=G.CustomMeleeHitEffect j=G.MarkerEffectEnabled w=G.MarkerEffectSize K=G.MarkerEffectTexture z=G.MarkerEffectVisibleTime M=G.MarkerEffectFadeTime b=G.MarkerPartColor end if p then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.CFrame=I F.Parent=Workspace.Terrain local E local function G(G)if d.HitEffectFolder[G.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\083\111\117\110\100\115")then local X=d.HitEffectFolder[G.Name].MaterialSounds:GetChildren()local W=math.random(1,#X)local k=X[W]if k~=nil then E=k:Clone()if k:FindFirstChild("\080\105\116\099\104")then E.PlaybackSpeed=(Random.new()):NextNumber(k.Pitch.Min.Value,k.Pitch.Max.Value)else E.PlaybackSpeed=(Random.new()):NextNumber(x,Q)end if k:FindFirstChild("\086\111\108\117\109\101")then E.Volume=(Random.new()):NextNumber(k.Volume.Min.Value,k.Volume.Max.Value)else E.Volume=B end E.Parent=F end else E=Instance.new("\083\111\117\110\100")E.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..u[math.random(1,#u)]E.PlaybackSpeed=(Random.new()):NextNumber(x,Q)E.Volume=B E.Parent=F end for E,k in pairs(d.HitEffectFolder[G.Name]:GetChildren())do if k.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local E=1 local S=k:Clone()S.Parent=F if S:FindFirstChild("\069\109\105\116\067\111\117\110\116")then E=S.EmitCount.Value end if S.PartColor.Value then local F=X and X.Color or Color3.fromRGB(255,255,255)if X and X:IsA("\084\101\114\114\097\105\110")then F=Workspace.Terrain:GetMaterialColor(W or Enum.Material.Sand)end S.Color=ColorSequence.new(F,F)end Thread:Delay(.01,function()v(S,E)Debris:AddItem(S,S.Lifetime.Max)end)end end E:Play()if j then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.Parent=k and X or Workspace.Terrain F.WorldCFrame=I*CFrame.Angles(math.rad(90),math.rad(180),0)if k then local E=w if d.HitEffectFolder[G.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\072\111\108\101\083\105\122\101")then E=d.HitEffectFolder[G.Name].MaterialHoleSize.Value end local k=Instance.new("\065\116\116\097\099\104\109\101\110\116")local P=Instance.new("\065\116\116\097\099\104\109\101\110\116")local I=S:Clone()I.Width0=E I.Width1=E if d.HitEffectFolder[G.Name]:FindFirstChild("\077\097\116\101\114\105\097\108\068\101\099\097\108\115")then local F=d.HitEffectFolder[G.Name].MaterialDecals:GetChildren()local E=math.random(1,#F)local k=F[E]if k~=nil then I.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..k.Value if k.PartColor.Value then local F=X and X.Color or Color3.fromRGB(255,255,255)if X and X:IsA("\084\101\114\114\097\105\110")then F=Workspace.Terrain:GetMaterialColor(W or Enum.Material.Sand)end I.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,F),ColorSequenceKeypoint.new(1,F)})end end else I.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..K[math.random(1,#K)]if b then local F=X and X.Color or Color3.fromRGB(255,255,255)if X and X:IsA("\084\101\114\114\097\105\110")then F=Workspace.Terrain:GetMaterialColor(W or Enum.Material.Sand)end I.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,F);ColorSequenceKeypoint.new(1,F)})end end I.Attachment0=k I.Attachment1=P k.Parent=X P.Parent=X k.WorldCFrame=(F.WorldCFrame*CFrame.new(E/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)P.WorldCFrame=(F.WorldCFrame*CFrame.new(-E/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)I.Parent=Workspace.Terrain Thread:Delay(z,function()U(k,P,I,F,M,O)end)else Debris:AddItem(F,5)end end end if not H then if d.HitEffectFolder:FindFirstChild(X.Material)then G(X.Material)else G(d.HitEffectFolder.Custom)end else G(d.HitEffectFolder.Custom)end Debris:AddItem(F,10)end end local function z(X,F,E,W,k,G,d,O,P)local I=CFrame.new(F,F+E)local p=G.BloodEnabled local u=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitCharSndIDs,G.HitCharSndIDs)local x=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitCharSndPitchMin,G.HitCharSndPitchMin)local Q=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitCharSndPitchMax,G.HitCharSndPitchMax)local B=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.HitCharSndVolume,G.HitCharSndVolume)local H=G.BloodWoundEnabled local j=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BloodWoundTexture,G.BloodWoundTexture)local w=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BloodWoundSize,G.BloodWoundSize)local K=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BloodWoundTextureColor,G.BloodWoundTextureColor)local b=T(G.ChargedShotAdvanceEnabled,d.ChargeLevel,G.ChargeAlterTable.BloodWoundPartColor,G.BloodWoundPartColor)local z=G.BloodWoundVisibleTime local M=G.BloodWoundFadeTime if P then p=G.MeleeBloodEnabled u=G.MeleeHitCharSndIDs x=G.MeleeHitCharSndPitchMin Q=G.MeleeHitCharSndPitchMax B=G.MeleeHitCharSndVolume H=G.MeleeBloodWoundEnabled j=G.MeleeBloodWoundTexture w=G.MeleeBloodWoundSize K=G.MeleeBloodWoundTextureColor b=G.MeleeBloodWoundVisibleTime z=G.MeleeBloodWoundFadeTime M=G.MeleeBloodWoundPartColor end if p then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.CFrame=I F.Parent=Workspace.Terrain local E=Instance.new("\083\111\117\110\100")E.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..u[math.random(1,#u)]E.PlaybackSpeed=(Random.new()):NextNumber(x,Q)E.Volume=B E.Parent=F for X,E in pairs(d.BloodEffectFolder:GetChildren())do if E.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local X=1 local W=E:Clone()W.Parent=F if W:FindFirstChild("\069\109\105\116\067\111\117\110\116")then X=W.EmitCount.Value end Thread:Delay(.01,function()v(W,X)Debris:AddItem(W,W.Lifetime.Max)end)end end E:Play()Debris:AddItem(F,10)if H then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.Parent=k and X or Workspace.Terrain F.WorldCFrame=I*CFrame.Angles(math.rad(90),math.rad(180),0)if k then local E=Instance.new("\065\116\116\097\099\104\109\101\110\116")local k=Instance.new("\065\116\116\097\099\104\109\101\110\116")local G=S:Clone()G.Width0=w G.Width1=w G.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..j[math.random(1,#j)]G.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,K),ColorSequenceKeypoint.new(1,K)})if b then local F=X and X.Color or Color3.fromRGB(255,255,255)if X and X:IsA("\084\101\114\114\097\105\110")then F=Workspace.Terrain:GetMaterialColor(W or Enum.Material.Sand)end G.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,F),ColorSequenceKeypoint.new(1,F)})end G.Attachment0=E G.Attachment1=k E.Parent=X k.Parent=X E.WorldCFrame=(F.WorldCFrame*CFrame.new(w/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)k.WorldCFrame=(F.WorldCFrame*CFrame.new(-w/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)G.Parent=Workspace.Terrain Thread:Delay(z,function()U(E,k,G,F,M,O)end)else Debris:AddItem(F,5)end end end end local function M(X,F,E,W,k,G)local d=W and W.Position or X.UserData.SegmentOrigin local O=j(d)if not T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosiveEnabled,X.UserData.ClientModule.ExplosiveEnabled)then if not W then return end if W.Instance and W.Instance.Parent then if W.Instance.Name=="\095\103\108\097\115\115"and T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.CanBreakGlass,X.UserData.ClientModule.CanBreakGlass)then if X.UserData.Replicate then ShatterGlass:FireServer(W.Instance,W.Position,E)end else if X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then if O then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end else local E=(W.Position-F).Magnitude local k=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local S=k and k:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local G=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 S and(S.Health>0 and G)then if O then z(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end if X.UserData.Replicate then if S.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",X.UserData.Tool,X.UserData.ClientModule,S,G,W.Instance,W.Instance.Size,X.UserData.Misc,E)end)if X.UserData.Tool and X.UserData.Tool.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then X.UserData.Tool.GunClient.MarkerEvent:Fire(X.UserData.ClientModule,W.Instance.Name=="\072\101\097\100"and X.UserData.ClientModule.HeadshotHitmarker)end end end else if O then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end end end end end else if X.UserData.ClientModule.ExplosionSoundEnabled then local F=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionSoundIDs,X.UserData.ClientModule.ExplosionSoundIDs)local E=Instance.new("\065\116\116\097\099\104\109\101\110\116")E.CFrame=CFrame.new(d)E.Parent=Workspace.Terrain local W=Instance.new("\083\111\117\110\100")W.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..F[math.random(1,#F)]W.PlaybackSpeed=(Random.new()):NextNumber(T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMin,X.UserData.ClientModule.ExplosionSoundPitchMin),T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMax,X.UserData.ClientModule.ExplosionSoundPitchMax))W.Volume=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionSoundVolume,X.UserData.ClientModule.ExplosionSoundVolume)W.Parent=E W:Play()Debris:AddItem(E,10)end local F=Instance.new("\069\120\112\108\111\115\105\111\110")F.BlastRadius=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionRadius,X.UserData.ClientModule.ExplosionRadius)F.BlastPressure=0 F.ExplosionType=Enum.ExplosionType.NoCraters F.Position=d F.Parent=Camera local k=W and CFrame.new(W.Position,W.Position+W.Normal)or CFrame.new(X.UserData.SegmentOrigin,X.UserData.SegmentOrigin+X.UserData.SegmentDirection)if O and W then if T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterEnabled,X.UserData.ClientModule.ExplosionCraterEnabled)then if W.Instance and W.Instance.Parent then local F=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local E=F and F:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if not E then local F=true local E=Instance.new("\065\116\116\097\099\104\109\101\110\116")E.Parent=F and W.Instance or Workspace.Terrain E.WorldCFrame=k*CFrame.Angles(math.rad(90),math.rad(180),0)if F then local F=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterSize,X.UserData.ClientModule.ExplosionCraterSize)local k=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterTexture,X.UserData.ClientModule.ExplosionCraterTexture)local G=Instance.new("\065\116\116\097\099\104\109\101\110\116")local d=Instance.new("\065\116\116\097\099\104\109\101\110\116")local O=S:Clone()O.Width0=F O.Width1=F O.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..k[math.random(1,#k)]if T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterPartColor,X.UserData.ClientModule.ExplosionCraterPartColor)then local X=W.Instance and W.Instance.Color or Color3.fromRGB(255,255,255)if W.Instance and W.Instance:IsA("\084\101\114\114\097\105\110")then X=Workspace.Terrain:GetMaterialColor(W.Material or Enum.Material.Sand)end O.Color=ColorSequence.new({ColorSequenceKeypoint.new(0,X),ColorSequenceKeypoint.new(1,X)})end O.Attachment0=G O.Attachment1=d G.Parent=W.Instance d.Parent=W.Instance G.WorldCFrame=(E.WorldCFrame*CFrame.new(F/2,-0.01,0))*CFrame.Angles(math.rad(90),0,0)d.WorldCFrame=(E.WorldCFrame*CFrame.new(-F/2,-0.01,0))*CFrame.Angles(math.rad(90),math.rad(180),0)O.Parent=Workspace.Terrain local P=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterVisibleTime,X.UserData.ClientModule.ExplosionCraterVisibleTime)local I=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionCraterFadeTime,X.UserData.ClientModule.ExplosionCraterFadeTime)Thread:Delay(P,function()U(G,d,O,E,I,X.UserData.Replicate)end)else Debris:AddItem(E,5)end end end end end if X.UserData.ClientModule.CustomExplosion then F.Visible=false if O then local F=Instance.new("\065\116\116\097\099\104\109\101\110\116")F.CFrame=k F.Parent=Workspace.Terrain for X,E in pairs(X.UserData.Misc.ExplosionEffectFolder:GetChildren())do if E.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local X=1 local W=E:Clone()W.Parent=F if W:FindFirstChild("\069\109\105\116\067\111\117\110\116")then X=W.EmitCount.Value end Thread:Delay(.01,function()v(W,X)Debris:AddItem(W,W.Lifetime.Max)end)end end Debris:AddItem(F,10)end end local G={}F.Hit:Connect(function(k,S)if k and X.UserData.Replicate then if k.Parent and k.Name=="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"or k.Name=="\072\101\097\100"then local E=k:FindFirstAncestorOfClass("\077\111\100\101\108")local d=E and E:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local O=E and(E:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or E:FindFirstChild("\072\101\097\100"))if d and O then if d.Health>0 then if not G[d]then if X.UserData.ClientModule.ExplosionKnockback then local W=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget,X.UserData.ClientModule.ExplosionKnockbackMultiplierOnTarget)local k=S/T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionRadius,X.UserData.ClientModule.ExplosionRadius)k=1-k local G=(O.Position-F.Position).Unit*T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackPower,X.UserData.ClientModule.ExplosionKnockbackPower)local P=(O.Velocity-Vector3.new(0,O.Velocity.y,0))+Vector3.new(G.X,0,G.Z)if DamageModule.CanDamage(E,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)then local X=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")X.MaxForce=Vector3.new(math.huge,0,math.huge)X.Velocity=P X.Parent=O O.Velocity=O.Velocity+Vector3.new(0,G.Y*W,0)Debris:AddItem(X,.25)else if d.Parent.Name==Player.Name then W=T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer,X.UserData.ClientModule.ExplosionKnockbackMultiplierOnPlayer)local F=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")F.MaxForce=Vector3.new(math.huge,0,math.huge)F.Velocity=P F.Parent=O O.Velocity=O.Velocity+Vector3.new(0,G.Y*W,0)Debris:AddItem(F,.25)end end end local P=W and W.Instance or k Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",X.UserData.Tool,X.UserData.ClientModule,d,O,P,P.Size,X.UserData.Misc,S)end)if X.UserData.Tool and X.UserData.Tool.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then X.UserData.Tool.GunClient.MarkerEvent:Fire(X.UserData.ClientModule,P.Name=="\072\101\097\100"and X.UserData.ClientModule.HeadshotHitmarker)end G[d]=true end end end elseif k.Name=="\095\103\108\097\115\115"and T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.CanBreakGlass,X.UserData.ClientModule.CanBreakGlass)then ShatterGlass:FireServer(k,k.Position,E)end end end)end end local function c(X,F,E,W,k,S)local G=X.UserData.CastBehavior.Hitscan and true or false local d=X:GetPosition()local O=X:GetVelocity()local P=X.UserData.CastBehavior.Acceleration if not X.UserData.CastBehavior.Hitscan then X.UserData.SpinData.InitalTick=os.clock()X.UserData.SpinData.InitalAngularVelocity=W.Normal:Cross(O)/.2 X.UserData.SpinData.InitalRotation=X.RayInfo.CurrentCFrame-X.RayInfo.CurrentCFrame.p X.UserData.SpinData.ProjectileOffset=.2*W.Normal if O.Magnitude>0 then local F=false local E=X.RayInfo.RaycastHitbox and d or W.Position if X.UserData.BounceData.BounceBetweenHumanoids then local S=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local G=S and S:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local d=S and(S:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or S:FindFirstChild("\072\101\097\100"))if G and(G.Health>0 and d)then if not table.find(X.UserData.BounceData.BouncedHumanoids,G)then table.insert(X.UserData.BounceData.BouncedHumanoids,G)end end local O,I,p=K(X,E)if O and(I and(p and I.Health>0))then local F=(p.Position-E).Unit if X.UserData.BounceData.PredictDirection then local X,W=DirectionPredictor(E,p.Position,Vector3.new(),p.Velocity,P,(2*p.Velocity)/3,k.Magnitude)if X and W then F=W.Unit end end X:SetVelocity(F*k.Magnitude)X:SetPosition(E)else F=true end else F=true end if F then local F=E-d local k=1-.001/F.Magnitude k=k<0 and 0 or k X:AddPosition(k*F+.05*W.Normal)local S=W.Normal local G=O if X.UserData.BounceData.IgnoreSlope and(P~=Vector3.new(0,0,0)and P.Y<0)then local F=X:GetPosition()G=Vector3.new(O.X,-X.UserData.BounceData.BounceHeight,O.Z)local E,k,d,P=H(X,F,Vector3.new(0,1,0),X.UserData.IgnoreList,true)if E then G=Vector3.new(O.X,X.UserData.BounceData.BounceHeight,O.Z)end local I=math.deg(math.asin(W.Normal.X))local p=math.deg(math.asin(W.Normal.Z))local u=math.floor(math.max(I==0 and p or I,I==0 and-p or-I))S=u>0 and(u>=X.UserData.BounceData.SlopeAngle and W.Normal or Vector3.new(0,W.Normal.Y,0))or W.Normal end local I=(Vector3.new()).Dot(S,G)*S local p=G-I local u local x=-(Vector3.new()).Dot(S,P)local Q=-(1+X.UserData.BounceData.BounceElasticity)*(Vector3.new()).Dot(S,G)u=1-(X.UserData.BounceData.FrictionConstant*((10*(x<0 and 0 or x))*X.StateInfo.Delta+(Q<0 and 0 or Q)))/p.Magnitude X:SetVelocity((u<0 and 0 or u)*p-X.UserData.BounceData.BounceElasticity*I)end G=true end else local F=false if X.UserData.BounceData.BounceBetweenHumanoids then local E=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local k=E and E:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local S=E and(E:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or E:FindFirstChild("\072\101\097\100"))if k and(k.Health>0 and S)then if not table.find(X.UserData.BounceData.BouncedHumanoids,k)then table.insert(X.UserData.BounceData.BouncedHumanoids,k)end end local G,d,O=K(X,W.Position)if G and(d and(O and d.Health>0))then local F=(O.Position-W.Position).Unit X.RayInfo.ModifiedDirection=F else F=true end else F=true end if F then local F=X.RayInfo.ModifiedDirection local E=F-(2*F:Dot(W.Normal))*W.Normal X.RayInfo.ModifiedDirection=E end end if G then if X.UserData.BounceData.CurrentBounces>0 then X.UserData.BounceData.CurrentBounces-=1 local G=j(W.Position)if X.UserData.BounceData.NoExplosionWhileBouncing then if W.Instance.Name=="\095\103\108\097\115\115"and T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.CanBreakGlass,X.UserData.ClientModule.CanBreakGlass)then if X.UserData.Replicate then ShatterGlass:FireServer(W.Instance,W.Position,k.Unit)end else if X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then if G then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end else local E=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local k=E and E:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local S=(W.Position-F).Magnitude local d=E and(E:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or E:FindFirstChild("\072\101\097\100"))if k and(k.Health>0 and d)then if G then z(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end if X.UserData.Replicate then if k.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",X.UserData.Tool,X.UserData.ClientModule,k,d,W.Instance,W.Instance.Size,X.UserData.Misc,S)end)if X.UserData.Tool and X.UserData.Tool.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then X.UserData.Tool.GunClient.MarkerEvent:Fire(X.UserData.ClientModule,W.Instance.Name=="\072\101\097\100"and X.UserData.ClientModule.HeadshotHitmarker)end end end else if G then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end end end end else M(X,F,E,W,k,S)end end end end local function y(X,F,E,W,k,S)if X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then if X.UserData.BounceData.StopBouncingOn=="\079\098\106\101\099\116"then return false end else local F=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local E=F and F:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local k=F and(F:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or F:FindFirstChild("\072\101\097\100"))if E and(E.Health>0 and k)then if X.UserData.BounceData.StopBouncingOn=="\072\117\109\097\110\111\105\100"then return false end else if X.UserData.BounceData.StopBouncingOn=="\079\098\106\101\099\116"then return false end end end if not X.UserData.CastBehavior.Hitscan and X.UserData.BounceData.SuperRicochet then return true else if X.UserData.BounceData.CurrentBounces>0 then return true end end return false end local function N(X,F,E,W,S,G)if not k then return end if X.UserData.PenetrationData then if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then local F=j(W.Position)if W.Instance and W.Instance.Parent then if W.Instance.Name=="\095\103\108\097\115\115"and T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.CanBreakGlass,X.UserData.ClientModule.CanBreakGlass)then return else if X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then if F then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end else local E=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local k=E and E:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local S=E and(E:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or E:FindFirstChild("\072\101\097\100"))if k and(k.Health>0 and S)then if F then z(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end else if F then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end end end end end end end if W.Instance and W.Instance.Parent then local F=X:DbgVisualizeHit(CFrame.new(W.Position),true)if F~=nil then F.Color3=Color3.fromRGB(13,105,172)end end end local function L(X,F,E,W,k,S)local G=j(W.Position)if W.Instance and W.Instance.Parent then if X.UserData.ClientModule.IgnoreBlacklistedParts and X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then return true else local d=W.Instance:FindFirstAncestorOfClass("\077\111\100\101\108")local O=d and d:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local P=W.Instance:FindFirstAncestorOfClass("\084\111\111\108")if W.Instance.Transparency>.75 or W.Instance.Name=="\077\105\115\115\105\108\101"or W.Instance.Name=="\072\097\110\100\108\101"or W.Instance.Name=="\069\102\102\101\099\116"or W.Instance.Name=="\066\117\108\108\101\116"or W.Instance.Name=="\076\097\115\101\114"or string.lower(W.Instance.Name)=="\119\097\116\101\114"or W.Instance.Name=="\082\097\105\108"or W.Instance.Name=="\065\114\114\111\119"or O and(O.Health<=0 or not DamageModule.CanDamage(d,X.UserData.Character,X.UserData.ClientModule.FriendlyFire)or X.UserData.PenetrationData and table.find(X.UserData.PenetrationData.HitHumanoids,O)or X.UserData.BounceData and table.find(X.UserData.BounceData.BouncedHumanoids,O))or P then return true else if X.UserData.PenetrationData then if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then if X.UserData.PenetrationData.PenetrationDepth<=0 then return false end elseif X.UserData.ClientModule.PenetrationType=="\072\117\109\097\110\111\105\100\080\101\110\101\116\114\097\116\105\111\110"then if X.UserData.PenetrationData.PenetrationAmount<=0 then return false end end local P=W.Instance.Size.Magnitude*E local I,p,u,x=Workspace:FindPartOnRayWithWhitelist(Ray.new(W.Position+P,-P),{W.Instance},X.RayInfo.Parameters.IgnoreWater)local Q=(p-W.Position).Magnitude if W.Instance.Name=="\095\103\108\097\115\115"and T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.CanBreakGlass,X.UserData.ClientModule.CanBreakGlass)then if X.UserData.Replicate then ShatterGlass:FireServer(W.Instance,W.Position,k.Unit)end if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then local F=1-(Q/X.UserData.PenetrationData.PenetrationDepth)/1.1 X.UserData.PenetrationData.PenetrationDepth*=F return true end else if X.UserData.ClientModule.BlacklistParts[W.Instance.Name]then if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then if G then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end local F=1-(Q/X.UserData.PenetrationData.PenetrationDepth)/1.1 X.UserData.PenetrationData.PenetrationDepth*=F if I then N(X,W.Position+P,-P,{Instance=I;Position=p,Normal=u,Material=x},k,S)end return true end else local E=(W.Position-F).Magnitude local B=d and(d:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or d:FindFirstChild("\072\101\097\100"))if O and(O.Health>0 and B)then if not table.find(X.UserData.PenetrationData.HitHumanoids,O)then table.insert(X.UserData.PenetrationData.HitHumanoids,O)if G then z(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end if X.UserData.Replicate then if O.Health>0 then Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110",X.UserData.Tool,X.UserData.ClientModule,O,B,W.Instance,W.Instance.Size,X.UserData.Misc,E)end)if X.UserData.Tool and X.UserData.Tool.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then X.UserData.Tool.GunClient.MarkerEvent:Fire(X.UserData.ClientModule,W.Instance.Name=="\072\101\097\100"and X.UserData.ClientModule.HeadshotHitmarker)end end end if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then local F=1-(Q/X.UserData.PenetrationData.PenetrationDepth)/1.1 X.UserData.PenetrationData.PenetrationDepth*=F if I then N(X,W.Position+P,-P,{Instance=I;Position=p;Normal=u;Material=x},k,S)end elseif X.UserData.ClientModule.PenetrationType=="\072\117\109\097\110\111\105\100\080\101\110\101\116\114\097\116\105\111\110"then X.UserData.PenetrationData.PenetrationAmount-=1 end if X.UserData.PenetrationData.PenetrationIgnoreDelay~=math.huge then Thread:Delay(X.UserData.PenetrationData.PenetrationIgnoreDelay,function()local F=table.find(X.UserData.PenetrationData.HitHumanoids,O)if F then table.remove(X.UserData.PenetrationData.HitHumanoids,F)end end)end return true end else if X.UserData.ClientModule.PenetrationType=="\087\097\108\108\080\101\110\101\116\114\097\116\105\111\110"then if G then b(W.Instance,W.Position,W.Normal,W.Material,true,X.UserData.ClientModule,X.UserData.Misc,X.UserData.Replicate)end local F=1-(Q/X.UserData.PenetrationData.PenetrationDepth)/1.1 X.UserData.PenetrationData.PenetrationDepth*=F if I then N(X,W.Position+P,-P,{Instance=I,Position=p,Normal=u,Material=x},k,S)end return true end end end end end end end end return false end local function f(X,F,E,W)if X.UserData.BulletParticleData.MotionBlur then local F=os.clock()local E=(CFrame.new()).pointToObjectSpace(Camera.CFrame,W)local k if X.UserData.BulletParticleData.T0 then k=(2/(F-X.UserData.BulletParticleData.T1))*(E-X.UserData.BulletParticleData.P1)-(E-X.UserData.BulletParticleData.P0)/(F-X.UserData.BulletParticleData.T0)else k=(E-X.UserData.BulletParticleData.P1)/(F-X.UserData.BulletParticleData.T1)X.UserData.BulletParticleData.V1=k end X.UserData.BulletParticleData.T0,X.UserData.BulletParticleData.V0,X.UserData.BulletParticleData.P0=X.UserData.BulletParticleData.T1,X.UserData.BulletParticleData.V1,X.UserData.BulletParticleData.P1 X.UserData.BulletParticleData.T1,X.UserData.BulletParticleData.V1,X.UserData.BulletParticleData.P1=F,k,E local S=X.UserData.BulletParticleData.T1-X.UserData.BulletParticleData.T0 local G=X.UserData.BulletParticleData.V0.Magnitude local d=X.UserData.BulletParticleData.V1.Magnitude X.UserData.BulletParticleData.Attachment0.Position=Camera.CFrame*X.UserData.BulletParticleData.P0 X.UserData.BulletParticleData.Attachment1.Position=Camera.CFrame*X.UserData.BulletParticleData.P1 if G>1e-08 then X.UserData.BulletParticleData.Attachment0.Axis=(CFrame.new()).vectorToWorldSpace(Camera.CFrame,X.UserData.BulletParticleData.V0/G)end if d>1e-08 then X.UserData.BulletParticleData.Attachment1.Axis=(CFrame.new()).vectorToWorldSpace(Camera.CFrame,X.UserData.BulletParticleData.V1/d)end local O=-X.UserData.BulletParticleData.P0.Z local P=-X.UserData.BulletParticleData.P1.Z if O<0 then O=0 end if P<0 then P=0 end local I=X.UserData.BulletParticleData.BulletSize+X.UserData.BulletParticleData.BulletBloom*O local p=X.UserData.BulletParticleData.BulletSize+X.UserData.BulletParticleData.BulletBloom*P local u=((X.UserData.BulletParticleData.P1-X.UserData.BulletParticleData.P0)*Vector3.new(1,1,0)).Magnitude local x=1-(((4*X.UserData.BulletParticleData.BulletSize)*X.UserData.BulletParticleData.BulletSize)/((I+p)*((2*u+I)+p)))*X.UserData.BulletParticleData.BulletBrightness for X,F in next,X.UserData.BulletParticleData.Effects do F.CurveSize0=(S/3)*G F.CurveSize1=(S/3)*d F.Width0=I F.Width1=p F.Transparency=NumberSequence.new(x)end else if(F-E).Magnitude>0 then local W=CFrame.new(E,F)-E local k=CFrame.Angles(0,math.pi/2,0)X.UserData.BulletParticleData.Attachment0.CFrame=(CFrame.new(F)*W)*k X.UserData.BulletParticleData.Attachment1.CFrame=CFrame.new(E,F)*k end end end local function m(X,F,E,W,k,S,G)X.UserData.LastSegmentOrigin=F X.UserData.SegmentOrigin=E X.UserData.SegmentDirection=W X.UserData.SegmentVelocity=S local d=os.clock()-X.UserData.SpinData.InitalTick if X.UserData.UpdateData.UpdateRayInExtra then if X.UserData.UpdateData.ExtraRayUpdater then X.UserData.UpdateData.ExtraRayUpdater(X,X.StateInfo.Delta)end end if not X.UserData.CastBehavior.Hitscan and X.UserData.HomeData.Homing then local F=X:GetPosition()local E=X:GetVelocity()if X.UserData.HomeData.LockOnOnHovering then if X.UserData.HomeData.LockedEntity then local W=X.UserData.HomeData.LockedEntity:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if W and W.Health>0 then local W=X.UserData.HomeData.LockedEntity:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or X.UserData.HomeData.LockedEntity:FindFirstChild("\084\111\114\115\111")or X.UserData.HomeData.LockedEntity:FindFirstChild("\085\112\112\101\114\084\111\114\115\111")local k=(W.Position-F).Unit local S=E.Unit local G=math.acos(k:Dot(S))if G>0 then local F=(S:Cross(k)).Unit local W=math.min(G,X.StateInfo.Delta*X.UserData.HomeData.TurnRatePerSecond)X:SetVelocity((CFrame.fromAxisAngle(F,W)):vectorToWorldSpace(E))end end end else local W,k,S=K(X,F)if W and(k and(S and k.Health>0))then local W=(S.Position-F).Unit local k=E.Unit local G=math.acos(W:Dot(k))if G>0 then local F=(k:Cross(W)).Unit local S=math.min(G,X.StateInfo.Delta*X.UserData.HomeData.TurnRatePerSecond)X:SetVelocity((CFrame.fromAxisAngle(F,S)):vectorToWorldSpace(E))end end end end local O if X.UserData.SpinData.CanSpinPart then if not X.UserData.CastBehavior.Hitscan then local F=E+X.UserData.SpinData.ProjectileOffset if X.UserData.BounceData.SuperRicochet then O=(CFrame.new(F,F+S)*Math.FromAxisAngle(d*X.UserData.SpinData.InitalAngularVelocity))*X.UserData.SpinData.InitalRotation else if X.UserData.BounceData.CurrentBounces>0 then O=(CFrame.new(F,F+S)*Math.FromAxisAngle(d*X.UserData.SpinData.InitalAngularVelocity))*X.UserData.SpinData.InitalRotation else O=CFrame.new(E,E+S)*CFrame.Angles(math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinX-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinX))),math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinY-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinY))),math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinZ-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinZ))))end end else O=CFrame.new(E,E+S)*CFrame.Angles(math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinX-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinX))),math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinY-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinY))),math.rad(-360*((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinZ-math.floor((os.clock()-X.UserData.ShootId/4)*X.UserData.SpinData.SpinZ))))end else O=CFrame.new(E,E+S)end X.RayInfo.CurrentCFrame=O if X.UserData.BulletParticleData then f(X,E,X.UserData.LastPosition,E)end if X.UserData.LaserData.LaserTrailEnabled then if X.StateInfo.Delta>0 then local W=X.UserData.LaserData.LaserTrailWidth local k=X.UserData.LaserData.LaserTrailHeight local S=Miscs[X.UserData.LaserData.LaserTrailShape.."\083\101\103\109\101\110\116"]:Clone()if X.UserData.LaserData.RandomizeLaserColorIn~="\078\111\110\101"then if X.UserData.LaserData.RandomizeLaserColorIn=="\087\104\111\108\101"then S.Color=X.UserData.LaserData.RandomLaserColor elseif X.UserData.LaserData.RandomizeLaserColorIn=="\083\101\103\109\101\110\116"then S.Color=Color3.new(math.random(),math.random(),math.random())end else S.Color=X.UserData.LaserData.LaserTrailColor end S.Material=X.UserData.LaserData.LaserTrailMaterial S.Reflectance=X.UserData.LaserData.LaserTrailReflectance S.Transparency=X.UserData.LaserData.LaserTrailTransparency S.Size=X.UserData.LaserData.LaserTrailShape=="\067\111\110\101"and Vector3.new(W,(E-F).Magnitude,k)or Vector3.new((E-F).Magnitude,k,W)S.CFrame=CFrame.new((F+E)*.5,E)*(X.UserData.LaserData.LaserTrailShape=="\067\111\110\101"and CFrame.Angles(math.pi/2,0,0)or CFrame.Angles(0,math.pi/2,0))S.Parent=Camera table.insert(X.UserData.LaserData.LaserTrailContainer,S)if X.UserData.LaserData.UpdateLaserTrail then X.UserData.LaserData.UpdateLaserTrail:Fire(X.UserData.LaserData.LaserTrailId,X.UserData.LaserData.LaserTrailContainer)end Thread:Delay(X.UserData.LaserData.LaserTrailVisibleTime,function()if X.UserData.LaserData.LaserTrailFadeTime>0 then local F=S.Size*(X.UserData.LaserData.ScaleLaserTrail and Vector3.new(1,X.UserData.LaserData.LaserTrailScaleMultiplier,X.UserData.LaserData.LaserTrailScaleMultiplier)or Vector3.new(1,1,1))local E=TweenService:Create(S,TweenInfo.new(X.UserData.LaserData.LaserTrailFadeTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Transparency=1;Size=F})E:Play()E.Completed:Wait()if S then local F=table.find(X.UserData.LaserData.LaserTrailContainer,S)if F then table.remove(X.UserData.LaserData.LaserTrailContainer,F)if X.UserData.LaserData.UpdateLaserTrail then X.UserData.LaserData.UpdateLaserTrail:Fire(X.UserData.LaserData.LaserTrailId,X.UserData.LaserData.LaserTrailContainer)end end S:Destroy()end else if S then local F=table.find(X.UserData.LaserData.LaserTrailContainer,S)if F then table.remove(X.UserData.LaserData.LaserTrailContainer,F)if X.UserData.LaserData.UpdateLaserTrail then X.UserData.LaserData.UpdateLaserTrail:Fire(X.UserData.LaserData.LaserTrailId,X.UserData.LaserData.LaserTrailContainer)end end S:Destroy()end end end)end end if X.UserData.LightningData.LightningBoltEnabled then if X.StateInfo.Delta>0 then local k=X.UserData.LightningData.BoltWideness local S=X.UserData.LightningData.BoltWidth local G=X.UserData.LightningData.BoltHeight for d,O in ipairs(X.UserData.LightningData.BoltCFrameTable)do local P if X.UserData.LightningData.BoltShape=="\066\108\111\099\107"then P=I elseif X.UserData.LightningData.BoltShape=="\067\121\108\105\110\100\101\114"then P=p elseif X.UserData.LightningData.BoltShape=="\067\111\110\101"then P=u end if P then local d=(CFrame.new(E,E+W)*O).p local I=(CFrame.new(F,F+W)*O).p local p=(I-d).Magnitude local u=d for F=0,p,10 do local E=(CFrame.new(d,I)*CFrame.new(0,0,-F-10))*CFrame.new(-2+math.random()*k,-2+math.random()*k,-2+math.random()*k)local W=P:GetPart()if X.UserData.LightningData.RandomizeBoltColorIn~="\078\111\110\101"then if X.UserData.LightningData.RandomizeBoltColorIn=="\087\104\111\108\101"then W.Color=X.UserData.LightningData.RandomBoltColor elseif X.UserData.LightningData.RandomizeBoltColorIn=="\083\101\103\109\101\110\116"then W.Color=Color3.new(math.random(),math.random(),math.random())end else W.Color=X.UserData.LightningData.BoltColor end W.Material=X.UserData.LightningData.BoltMaterial W.Reflectance=X.UserData.LightningData.BoltReflectance W.Transparency=X.UserData.LightningData.BoltTransparency if F+10>p then W.CFrame=(CFrame.new(u,I)*CFrame.new(0,0,-(u-I).Magnitude/2))*(X.UserData.LightningData.BoltShape=="\067\111\110\101"and CFrame.Angles(math.pi/2,0,0)or CFrame.Angles(0,math.pi/2,0))else W.CFrame=(CFrame.new(u,E.p)*CFrame.new(0,0,-(u-E.p).Magnitude/2))*(X.UserData.LightningData.BoltShape=="\067\111\110\101"and CFrame.Angles(math.pi/2,0,0)or CFrame.Angles(0,math.pi/2,0))end if F+10>p then W.Size=X.UserData.LightningData.BoltShape=="\067\111\110\101"and Vector3.new(S,(u-I).Magnitude,G)or Vector3.new((u-I).Magnitude,G,S)else W.Size=X.UserData.LightningData.BoltShape=="\067\111\110\101"and Vector3.new(S,(u-E.p).Magnitude,G)or Vector3.new((u-E.p).Magnitude,G,S)end Thread:Delay(X.UserData.LightningData.BoltVisibleTime,function()if X.UserData.LightningData.BoltFadeTime>0 then local F=W.Size*(X.UserData.LightningData.ScaleBolt and Vector3.new(1,X.UserData.LightningData.BoltScaleMultiplier,X.UserData.LightningData.BoltScaleMultiplier)or Vector3.new(1,1,1))local E=TweenService:Create(W,TweenInfo.new(X.UserData.LightningData.BoltFadeTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Transparency=1;Size=F})E:Play()E.Completed:Wait()if W~=nil then P:ReturnPart(W)end else if W~=nil then P:ReturnPart(W)end end end)u=E.p end end end end end if not X.UserData.Replicate and X.UserData.ClientModule.WhizSoundEnabled then if not X.UserData.Whizzed then local F=(Camera.CFrame.p-E).Magnitude if F<X.UserData.ClientModule.WhizDistance then local F=Instance.new("\083\111\117\110\100")F.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..X.UserData.ClientModule.WhizSoundIDs[math.random(1,#X.UserData.ClientModule.WhizSoundIDs)]F.Volume=X.UserData.ClientModule.WhizSoundVolume F.PlaybackSpeed=(Random.new()):NextNumber(X.UserData.ClientModule.WhizSoundPitchMin,X.UserData.ClientModule.WhizSoundPitchMax)F.Name="\087\104\105\122\083\111\117\110\100"F.Parent=SoundService F:Play()Debris:AddItem(F,F.TimeLength/F.PlaybackSpeed)X.UserData.Whizzed=true end end end X.UserData.LastPosition=E if G==nil then return end G.CFrame=O end local function r(X,F,E)if X.UserData.LaserData.UpdateLaserTrail then X.UserData.LaserData.UpdateLaserTrail:Fire(X.UserData.LaserData.LaserTrailId,X.UserData.LaserData.LaserTrailContainer,true)end if X.UserData.BulletParticleData then X.UserData.BulletParticleData.Attachment0:Destroy()X.UserData.BulletParticleData.Attachment1:Destroy()for X,F in next,X.UserData.BulletParticleData.Effects do F:Destroy()end end local k=X.RayInfo.CosmeticBulletObject if k~=nil then local S=X:GetPosition()local G=X:GetVelocity()if E then if X.UserData.DebrisData.DecayProjectile then if Q<=W then Q+=1 local F=k:Clone()F.Name="\068\101\099\097\121\080\114\111\106\101\099\116\105\108\101"F.CFrame=k.CFrame F.Anchored=X.UserData.DebrisData.AnchorDecay F.CanCollide=X.UserData.DebrisData.CollideDecay if not F.Anchored then if X.UserData.DebrisData.VelocityInfluence then F.Velocity=F.CFrame.LookVector*G.Magnitude else F.Velocity=F.CFrame.LookVector*X.UserData.DebrisData.DecayVelocity end end for F,E in pairs(F:GetDescendants())do if(E:IsA("\080\111\105\110\116\076\105\103\104\116")or E:IsA("\083\117\114\102\097\099\101\076\105\103\104\116")or E:IsA("\083\112\111\116\076\105\103\104\116"))and X.UserData.DebrisData.DisableDebrisContents.DisableTrail then E.Enabled=false elseif E:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")and X.UserData.DebrisData.DisableDebrisContents.Particle then E.Enabled=false elseif E:IsA("\084\114\097\105\108")and X.UserData.DebrisData.DisableDebrisContents.Trail then E.Enabled=false elseif E:IsA("\066\101\097\109")and X.UserData.DebrisData.DisableDebrisContents.Beam then E.Enabled=false elseif E:IsA("\083\111\117\110\100")and X.UserData.DebrisData.DisableDebrisContents.Sound then E:Stop()end end F.Parent=Camera Thread:Delay(5,function()if F then F:Destroy()end Q-=1 end)end end else if F then local E=F.Instance.CFrame:pointToObjectSpace(F.Position)if X.UserData.DebrisData.DebrisProjectile then if Q<=W then Q+=1 local W=k:Clone()W.Name="\068\101\098\114\105\115\080\114\111\106\101\099\116\105\108\101"W.CFrame=X.UserData.DebrisData.NormalizeDebris and CFrame.new(F.Position,F.Position+F.Normal)or F.Instance.CFrame*CFrame.new(E,E+F.Instance.CFrame:vectorToObjectSpace(X.UserData.SegmentVelocity.Unit))W.Anchored=X.UserData.DebrisData.AnchorDebris W.CanCollide=X.UserData.DebrisData.CollideDebris if not W.Anchored and X.UserData.DebrisData.BounceDebris then local E=W.CFrame.LookVector local k=E-(2*E:Dot(F.Normal))*F.Normal W.Velocity=k*(X.UserData.DebrisData.BounceVelocity*(G.Magnitude/T(X.UserData.ClientModule.ChargedShotAdvanceEnabled,X.UserData.Misc.ChargeLevel,X.UserData.ClientModule.ChargeAlterTable.BulletSpeed,X.UserData.ClientModule.BulletSpeed)))W.CFrame=CFrame.new(W.Position,W.Position+W.Velocity)end for F,E in pairs(W:GetDescendants())do if(E:IsA("\080\111\105\110\116\076\105\103\104\116")or E:IsA("\083\117\114\102\097\099\101\076\105\103\104\116")or E:IsA("\083\112\111\116\076\105\103\104\116"))and X.UserData.DebrisData.DisableDebrisContents.DisableTrail then E.Enabled=false elseif E:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")and X.UserData.DebrisData.DisableDebrisContents.Particle then E.Enabled=false elseif E:IsA("\084\114\097\105\108")and X.UserData.DebrisData.DisableDebrisContents.Trail then E.Enabled=false elseif E:IsA("\066\101\097\109")and X.UserData.DebrisData.DisableDebrisContents.Beam then E.Enabled=false elseif E:IsA("\083\111\117\110\100")and X.UserData.DebrisData.DisableDebrisContents.Sound then E:Stop()end end W.Parent=Camera Thread:Delay(5,function()if W then W:Destroy()end Q-=1 end)end end end end k.Transparency=1 for X,F in pairs(k:GetDescendants())do if F:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")or F:IsA("\080\111\105\110\116\076\105\103\104\116")or F:IsA("\083\117\114\102\097\099\101\076\105\103\104\116")or F:IsA("\083\112\111\116\076\105\103\104\116")or F:IsA("\084\114\097\105\108")or F:IsA("\066\101\097\109")or F:IsA("\066\105\108\108\098\111\097\114\100\071\117\105")or F:IsA("\083\117\114\102\097\099\101\071\117\105")then F.Enabled=false elseif F:IsA("\083\111\117\110\100")then F:Stop()elseif F:IsA("\068\101\099\097\108")or F:IsA("\084\101\120\116\117\114\101")or F:IsA("\066\097\115\101\080\097\114\116")then F.Transparency=1 end end if X.UserData.CastBehavior.CosmeticBulletProvider~=nil then if k~=nil then X.UserData.CastBehavior.CosmeticBulletProvider:ReturnPart(k)end else Debris:AddItem(k,5)end end end function ProjectileHandler.VisualizeHitEffect(O,X,F,E,W,k,S,G,d)if d then VisualizeHitEffect:FireServer(X,F,E,W,k,S,G)end local P=j(E)if P then if X=="\078\111\114\109\097\108"then b(F,E,W,k,true,S,G,d,true)elseif X=="\066\108\111\111\100"then z(F,E,W,k,true,S,G,d,true)end end end function ProjectileHandler.SimulateProjectile(p,X,F,E,W,k,S,G,d,O,I)if W and(X and F)then if G then if not G:IsDescendantOf(Workspace)and not G:IsDescendantOf(X)then return end else return end if I then VisualizeBullet:FireServer(X,F,E,W,k,S,G,d,O)end local p=d local u=S if E~=nil then p=E:FindFirstChild("\071\117\110\077\117\122\122\108\101\080\111\105\110\116"..W.ModuleName)u=k end if p then if W.MuzzleFlashEnabled then for X,F in pairs(O.MuzzleFolder:GetChildren())do if F.ClassName=="\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114"then local X=1 local E=F:Clone()E.Parent=p if E:FindFirstChild("\069\109\105\116\067\111\117\110\116")then X=E.EmitCount.Value end Thread:Delay(.01,function()E:Emit(X)Debris:AddItem(E,E.Lifetime.Max)end)end end end if W.MuzzleLightEnabled then local X=Instance.new("\080\111\105\110\116\076\105\103\104\116")X.Brightness=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LightBrightness,W.LightBrightness)X.Color=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LightColor,W.LightColor)X.Range=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LightRange,W.LightRange)X.Shadows=W.LightShadows X.Enabled=true X.Parent=p Debris:AddItem(X,W.VisibleTime)end end local Q=X.Parent local H={Camera;X;Q}local j=RaycastParams.new()j.IgnoreWater=true j.FilterType=Enum.RaycastFilterType.Blacklist j.FilterDescendantsInstances=H local w=OverlapParams.new()w.FilterType=Enum.RaycastFilterType.Blacklist w.FilterDescendantsInstances=H w.MaxParts=0 w.CollisionGroup="\068\101\102\097\117\108\116"x+=1 local K={}local v local U=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailEnabled,W.LaserTrailEnabled)local b=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.DamageableLaserTrail,W.DamageableLaserTrail)if I then if U and b then v=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")v.Name="\085\112\100\097\116\101\076\097\115\101\114\084\114\097\105\108\095"..HttpService:GenerateGUID()end end for F,k in pairs(u)do if G then if not G:IsDescendantOf(Workspace)and not G:IsDescendantOf(X)then return end else return end local S=G.WorldCFrame local d,p=G.WorldPosition,k if E~=nil then S=(E:FindFirstChild("\071\117\110\070\105\114\101\080\111\105\110\116"..W.ModuleName)).WorldCFrame d=(E:FindFirstChild("\071\117\110\070\105\114\101\080\111\105\110\116"..W.ModuleName)).WorldPosition end local u=Q:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116",1)local w=S local z=w.Position local M=w.LookVector local c=math.abs((u.Position-z):Dot(M))+1 local N=Ray.new(z-M.Unit*c,M.Unit*c)local f,m=Workspace:FindPartOnRayWithIgnoreList(N,H,false,true)if f and math.abs((z-m).Magnitude)>0 then d=m-M.Unit*.1 end local r=u.Velocity local Z=p*T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletSpeed,W.BulletSpeed)local g local A local h=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.ProjectileType,W.ProjectileType)if h~="\078\111\110\101"then local X=Projectiles:FindFirstChild(h)if X then local F=false for E,W in pairs(B)do if W.ProjectileName==X.Name then F=true A=Camera:FindFirstChild("\080\114\111\106\101\099\116\105\108\101\067\111\110\116\097\105\110\101\114\095\040"..(X.Name.."\041"))g=W.CosmeticPartProvider break end end if not F then A=Instance.new("\070\111\108\100\101\114")A.Name="\080\114\111\106\101\099\116\105\108\101\067\111\110\116\097\105\110\101\114\095\040"..(X.Name.."\041")A.Parent=Camera g=PartCache.new(X,100,A)table.insert(B,{ProjectileName=X.Name,CosmeticPartProvider=g})end end end local i=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.PenetrationDepth,W.PenetrationDepth)local J=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.PenetrationAmount,W.PenetrationAmount)local a if i>0 or J>0 then a={PenetrationDepth=i;PenetrationAmount=J,PenetrationIgnoreDelay=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.PenetrationIgnoreDelay,W.PenetrationIgnoreDelay),HitHumanoids={}}end local q=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.SpinX,W.SpinX)local R=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.SpinY,W.SpinY)local n=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.SpinZ,W.SpinZ)local s if T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletParticle,W.BulletParticle)then local X=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletType,W.BulletType)if X~="\078\111\110\101"then local F=Bullets[X].Attachment0:Clone()local E=Bullets[X].Attachment1:Clone()local k={}F.Parent=Workspace.Terrain E.Parent=Workspace.Terrain for X,W in next,Bullets[X]:GetChildren()do if W:IsA("\066\101\097\109")or W:IsA("\084\114\097\105\108")then local X=W:Clone()X.Attachment0=F X.Attachment1=E X.Parent=Workspace.Terrain table.insert(k,X)end end s={T0=nil,P0=nil,V0=nil,T1=os.clock(),P1=(CFrame.new()).pointToObjectSpace(Camera.CFrame,d),V1=nil;Attachment0=F,Attachment1=E;Effects=k;MotionBlur=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.MotionBlur,W.MotionBlur);BulletSize=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletSize,W.BulletSize);BulletBloom=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletBloom,W.BulletBloom);BulletBrightness=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BulletBrightness,W.BulletBrightness)}end end local l=FastCast.newBehavior()l.RaycastParams=j l.TravelType=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.TravelType,W.TravelType)l.MaxDistance=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.Range,W.Range)l.Lifetime=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.Lifetime,W.Lifetime)l.HighFidelityBehavior=FastCast.HighFidelityBehavior.Default l.CosmeticBulletProvider=g l.CosmeticBulletContainer=A l.Acceleration=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.Acceleration,W.Acceleration)l.AutoIgnoreContainer=false l.HitEventOnTermination=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.HitEventOnTermination,W.HitEventOnTermination)l.CanPenetrateFunction=L l.CanHitFunction=y local V=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.RaycastHitbox,W.RaycastHitbox)local D=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.RaycastHitboxData,W.RaycastHitboxData)l.RaycastHitbox=(V and#D>0)and D or nil l.CurrentCFrame=CFrame.new(d,d+p)l.ModifiedDirection=(CFrame.new(d,d+p)).LookVector l.Hitscan=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.HitscanMode,W.HitscanMode)local t=HttpService:GenerateGUID()if I then if U and b then table.insert(K,{Id=t;LaserContainer={};HitHumanoids={};Terminate=false})end end local Y={}local C=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LightningBoltEnabled,W.LightningBoltEnabled)if C then local X=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltRadius,W.BoltRadius)for F=1,T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltCount,W.BoltCount),1 do if F==1 then table.insert(Y,CFrame.new(0,0,0))else table.insert(Y,CFrame.new(math.random(-X,X),math.random(-X,X),0))end end end l.UserData={ShootId=x,Tool=X,Character=Q,ClientModule=W;Misc=O,Replicate=I,PenetrationData=a,BulletParticleData=s,LaserData={LaserTrailEnabled=U;LaserTrailWidth=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailWidth,W.LaserTrailWidth);LaserTrailHeight=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailHeight,W.LaserTrailHeight);LaserTrailColor=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailColor,W.LaserTrailColor),RandomizeLaserColorIn=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.RandomizeLaserColorIn,W.RandomizeLaserColorIn);LaserTrailMaterial=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailMaterial,W.LaserTrailMaterial),LaserTrailShape=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailShape,W.LaserTrailShape);LaserTrailReflectance=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailReflectance,W.LaserTrailReflectance);LaserTrailTransparency=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailTransparency,W.LaserTrailTransparency),LaserTrailVisibleTime=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailVisibleTime,W.LaserTrailVisibleTime),LaserTrailFadeTime=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailFadeTime,W.LaserTrailFadeTime);ScaleLaserTrail=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.ScaleLaserTrail,W.ScaleLaserTrail);LaserTrailScaleMultiplier=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailScaleMultiplier,W.LaserTrailScaleMultiplier),RandomLaserColor=Color3.new(math.random(),math.random(),math.random()),LaserTrailId=t,UpdateLaserTrail=v;LaserTrailContainer={}},LightningData={LightningBoltEnabled=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LightningBoltEnabled,W.LightningBoltEnabled);BoltWideness=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltWideness,W.BoltWideness);BoltWidth=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltWidth,W.BoltWidth),BoltHeight=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltHeight,W.BoltHeight);BoltColor=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltColor,W.BoltColor);RandomizeBoltColorIn=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.RandomizeBoltColorIn,W.RandomizeBoltColorIn);BoltMaterial=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltMaterial,W.BoltMaterial),BoltShape=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltShape,W.BoltShape);BoltReflectance=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltReflectance,W.BoltReflectance);BoltTransparency=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltTransparency,W.BoltTransparency),BoltVisibleTime=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltVisibleTime,W.BoltVisibleTime);BoltFadeTime=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltFadeTime,W.BoltFadeTime);ScaleBolt=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.ScaleBolt,W.ScaleBolt);BoltScaleMultiplier=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BoltScaleMultiplier,W.BoltScaleMultiplier);RandomBoltColor=Color3.new(math.random(),math.random(),math.random());BoltCFrameTable=Y};SpinData={CanSpinPart=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.CanSpinPart,W.CanSpinPart),SpinX=q;SpinY=R;SpinZ=n,InitalTick=os.clock(),InitalAngularVelocity=Vector3.new(q,R,n),InitalRotation=l.CurrentCFrame-l.CurrentCFrame.p,ProjectileOffset=Vector3.new()};DebrisData={DebrisProjectile=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.DebrisProjectile,W.DebrisProjectile),AnchorDebris=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.AnchorDebris,W.AnchorDebris),CollideDebris=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.CollideDebris,W.CollideDebris);NormalizeDebris=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.NormalizeDebris,W.NormalizeDebris),BounceDebris=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BounceDebris,W.BounceDebris);BounceVelocity=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BounceVelocity,W.BounceVelocity);DecayProjectile=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.DecayProjectile,W.DecayProjectile),AnchorDecay=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.AnchorDecay,W.AnchorDecay);CollideDecay=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.CollideDecay,W.CollideDecay),DecayVelocity=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.DecayVelocity,W.DecayVelocity),VelocityInfluence=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.VelocityInfluence,W.VelocityInfluence);DisableDebrisContents=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.DisableDebrisContents,W.DisableDebrisContents)},BounceData={CurrentBounces=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.RicochetAmount,W.RicochetAmount),BounceElasticity=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BounceElasticity,W.BounceElasticity),FrictionConstant=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.FrictionConstant,W.FrictionConstant);IgnoreSlope=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.IgnoreSlope,W.IgnoreSlope),SlopeAngle=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.SlopeAngle,W.SlopeAngle),BounceHeight=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BounceHeight,W.BounceHeight),NoExplosionWhileBouncing=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.NoExplosionWhileBouncing,W.NoExplosionWhileBouncing),StopBouncingOn=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.StopBouncingOn,W.StopBouncingOn);SuperRicochet=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.SuperRicochet,W.SuperRicochet),BounceBetweenHumanoids=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.BounceBetweenHumanoids,W.BounceBetweenHumanoids);PredictDirection=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.PredictDirection,W.PredictDirection);BouncedHumanoids={}},HomeData={Homing=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.Homing,W.Homing);HomingDistance=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.HomingDistance,W.HomingDistance),TurnRatePerSecond=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.TurnRatePerSecond,W.TurnRatePerSecond),HomeThroughWall=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.HomeThroughWall,W.HomeThroughWall);LockOnOnHovering=W.LockOnOnHovering,LockedEntity=O.LockedEntity},UpdateData={UpdateRayInExtra=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.UpdateRayInExtra,W.UpdateRayInExtra),ExtraRayUpdater=T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.ExtraRayUpdater,W.ExtraRayUpdater)};IgnoreList=H;LastSegmentOrigin=Vector3.new(),SegmentOrigin=Vector3.new(),SegmentDirection=Vector3.new();SegmentVelocity=Vector3.new(),LastPosition=d,CastBehavior=l,Whizzed=false}local e=P:Fire(d,p,Z,l)end if I then if U and b then if v then v.Event:Connect(function(X,F,E)for W,k in pairs(K)do if k.Id==X then k.LaserContainer=F if E then k.Terminate=true end break end end end)end local F F=RunService.Heartbeat:Connect(function(E)if#K<=0 then if v then v:Destroy()end if F then F:Disconnect()F=nil end else for F,E in next,K,nil do local k=false if E.Terminate then if#E.LaserContainer<=0 then k=true table.remove(K,F)end end if not k then for F,k in pairs(E.LaserContainer)do if k then local F=Workspace:GetPartsInPart(k,w)for F,k in pairs(F)do if k and k.Parent then local F=k:FindFirstAncestorOfClass("\077\111\100\101\108")local S=F and F:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")local G=F and(F:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or k.Parent:FindFirstChild("\072\101\097\100"))if S and(S.Parent~=Q and G)then if S.Health>0 then if not table.find(E.HitHumanoids,S)then table.insert(E.HitHumanoids,S)Thread:Spawn(function()InflictTarget:InvokeServer("\071\117\110\076\097\115\101\114",X,W,S,G,k,k.Size,O)end)if X and X.GunClient:FindFirstChild("\077\097\114\107\101\114\069\118\101\110\116")then X.GunClient.MarkerEvent:Fire(W,false)end if T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailConstantDamage,W.LaserTrailConstantDamage)then Thread:Delay(T(W.ChargedShotAdvanceEnabled,O.ChargeLevel,W.ChargeAlterTable.LaserTrailDamageRate,W.LaserTrailDamageRate),function()local X=table.find(E.HitHumanoids,S)if X then table.remove(E.HitHumanoids,X)end end)end end end end end end end end end end end end)end end end end P.RayFinalHit:Connect(M)P.RayHit:Connect(c)P.LengthChanged:Connect(m)P.CastTerminating:Connect(r)return ProjectileHandler

local OptimalEffects = false -- Adjust details of effects by client quality level
local RenderDistance = 400 -- Maximum camera distance to render visual effects
local ScreenCullingEnabled = true -- Show visual effects when their positions are on screen
local MaxDebrisCounts = 100 -- Maximum number of debris objects (mostly decayed projectiles) to exist
local RayExit = true -- Only for Wall Penetration
FastCast.DebugLogging = false
FastCast.VisualizeCasts = false

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

local BlockSegContainer = Instance.new("Folder")
BlockSegContainer.Name = "BlockSegContainer"
BlockSegContainer.Parent = Camera

local CylinderSegContainer = Instance.new("Folder")
CylinderSegContainer.Name = "CylinderSegContainer"
CylinderSegContainer.Parent = Camera

local ConeSegContainer = Instance.new("Folder")
ConeSegContainer.Name = "ConeSegContainer"
ConeSegContainer.Parent = Camera

local Caster = FastCast.new()

local BlockSegCache = PartCache.new(Miscs.BlockSegment, 500)
BlockSegCache:SetCacheParent(BlockSegContainer)

local CylinderSegCache = PartCache.new(Miscs.CylinderSegment, 500)
CylinderSegCache:SetCacheParent(CylinderSegContainer)

local ConeSegCache = PartCache.new(Miscs.ConeSegment, 500)
ConeSegCache:SetCacheParent(ConeSegContainer)

local ShootId = 0
local DebrisCounts = 0
local PartCacheStorage = {}

local function CastWithBlacklist(Cast, Origin, Direction, Blacklist, IgnoreWater)
	local CastRay = Ray.new(Origin, Direction)
	local HitPart, HitPoint, HitNormal, HitMaterial = nil, Origin + Direction, Vector3.new(0, 1, 0), Enum.Material.Air
	local Success = false	
	repeat
		HitPart, HitPoint, HitNormal, HitMaterial = Workspace:FindPartOnRayWithIgnoreList(CastRay, Blacklist, false, IgnoreWater)
		if HitPart then
			--if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[HitPart.Name] then
			--	table.insert(Blacklist, HitPart)
			--	Success	= false
			--else
				local Target = HitPart:FindFirstAncestorOfClass("Model")
				local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
				local TargetTool = HitPart:FindFirstAncestorOfClass("Tool")
				if (HitPart.Transparency > 0.75
					or HitPart.Name == "Missile"
					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 (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
					or TargetTool) then
					table.insert(Blacklist, HitPart)
					Success	= false
				else
					Success	= true
				end				
			--end
		else
			Success	= true
		end
	until Success
	return HitPart, HitPoint, HitNormal, HitMaterial
end

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 CanShowEffects(Position)
	if ScreenCullingEnabled then
		local _, OnScreen = Camera:WorldToScreenPoint(Position)
		return OnScreen and (Position - Camera.CFrame.p).Magnitude <= RenderDistance
	end
	return (Position - Camera.CFrame.p).Magnitude <= RenderDistance
end

local function PopulateHumanoids(Cast, Model)
	if Model.ClassName == "Humanoid" then
		if DamageModule.CanDamage(Model.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
			table.insert(Humanoids, Model)
		end
	end
	for i, mdl in ipairs(Model:GetChildren()) do
		PopulateHumanoids(Cast, mdl)
	end
end

local function FindNearestEntity(Cast, Position)
	Humanoids = {}
	PopulateHumanoids(Cast, Workspace)
	local Dist = Cast.UserData.HomeData.HomingDistance
	local TargetModel = nil
	local TargetHumanoid = nil
	local TargetTorso = nil
	for i, v in ipairs(Humanoids) do
		local torso = v.Parent:FindFirstChild("HumanoidRootPart") or v.Parent:FindFirstChild("Torso") or v.Parent:FindFirstChild("UpperTorso")
		if v and torso then
			if (torso.Position - Position).Magnitude < (Dist + (torso.Size.Magnitude / 2.5)) and v.Health > 0 then
				if not Cast.UserData.HomeData.HomeThroughWall then
					local hit, pos, normal, material = CastWithBlacklist(Cast, Position, (torso.CFrame.p - Position).Unit * 999, Cast.UserData.IgnoreList, true)
					if hit then
						if hit:IsDescendantOf(v.Parent) then
							if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
								TargetModel = v.Parent
								TargetHumanoid = v
								TargetTorso = torso
								Dist = (Position - torso.Position).Magnitude
							end
						end
					end
				else
					if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
						TargetModel = v.Parent
						TargetHumanoid = v
						TargetTorso = torso
						Dist = (Position - torso.Position).Magnitude
					end
				end						
			end
		end	
	end
	return TargetModel, TargetHumanoid, TargetTorso
end

local function EmitParticle(Particle, Count)
	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
end

local function FadeBeam(A0, A1, Beam, Hole, FadeTime, Replicate)
	if FadeTime > 0 then
		if OptimalEffects then
			if Replicate then
				local t0 = os.clock()
				while Hole ~= nil do
					local Alpha = math.min((os.clock() - t0) / FadeTime, 1)
					if Beam then Beam.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 Beam then Beam:Destroy() end
				if Hole then Hole:Destroy() end
			else
				if A0 then A0:Destroy() end
				if A1 then A1:Destroy() end
				if Beam then Beam: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) / FadeTime, 1)
				if Beam then Beam.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 Beam then Beam:Destroy() end
			if Hole then Hole:Destroy() end
		end
	else
		if A0 then A0:Destroy() end
		if A1 then A1:Destroy() end
		if Beam then Beam:Destroy() end
		if Hole then Hole:Destroy() end
	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")
				Sound.SoundId = "rbxassetid://"..HitSoundIDs[math.random(1, #HitSoundIDs)]
				Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
				Sound.Volume = HitSoundVolume
				Sound.Parent = Attachment
			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()
						EmitParticle(Particle, Count)
						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()
						FadeBeam(A0, A1, BeamClone, Hole, BulletHoleFadeTime, Replicate)
					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.MeleeBloodWoundTexture
		BloodWoundSize = ClientModule.MeleeBloodWoundSize
		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()
					EmitParticle(Particle, Count)
					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()
					FadeBeam(A0, A1, BeamClone, Hole, BloodWoundFadeTime, Replicate)
				end)
			else
				Debris:AddItem(Hole, 5)
			end
		end
	end
end

local function OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
	local EndPos = RaycastResult and RaycastResult.Position or Cast.UserData.SegmentOrigin
	local ShowEffects = CanShowEffects(EndPos)	
	if not AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosiveEnabled, Cast.UserData.ClientModule.ExplosiveEnabled) then
		if not RaycastResult then
			return
		end
		if RaycastResult.Instance and RaycastResult.Instance.Parent then
			if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
				if Cast.UserData.Replicate then
					ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, Direction)
				end
			else
				if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
					if ShowEffects then
						MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
					end
				else
					local Distance = (RaycastResult.Position - Origin).Magnitude
					local Target = RaycastResult.Instance: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(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
						end
						if Cast.UserData.Replicate then
							if TargetHumanoid.Health > 0 then
								Thread:Spawn(function()
									InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
								end)
								if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
									Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
								end
							end
						end	
					else
						if ShowEffects then
							MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
						end
					end					
				end			
			end
		end
	else
		if Cast.UserData.ClientModule.ExplosionSoundEnabled then
			local SoundTable = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundIDs, Cast.UserData.ClientModule.ExplosionSoundIDs)
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = CFrame.new(EndPos)
			Attachment.Parent = Workspace.Terrain
			local Sound = Instance.new("Sound")
			Sound.SoundId = "rbxassetid://"..SoundTable[math.random(1, #SoundTable)]
			Sound.PlaybackSpeed = Random.new():NextNumber(AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMin, Cast.UserData.ClientModule.ExplosionSoundPitchMin), AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMax, Cast.UserData.ClientModule.ExplosionSoundPitchMax))
			Sound.Volume = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundVolume, Cast.UserData.ClientModule.ExplosionSoundVolume)
			Sound.Parent = Attachment
			Sound:Play()
			Debris:AddItem(Attachment, 10)		
		end

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

		local SurfaceCF = RaycastResult and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or CFrame.new(Cast.UserData.SegmentOrigin, Cast.UserData.SegmentOrigin + Cast.UserData.SegmentDirection)
		
		if ShowEffects and RaycastResult then 
			if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterEnabled, Cast.UserData.ClientModule.ExplosionCraterEnabled) then
				if RaycastResult.Instance and RaycastResult.Instance.Parent then
					local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
					local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
					if not TargetHumanoid then
						local ParentToPart = true
						local Hole = Instance.new("Attachment")
						Hole.Parent = ParentToPart and RaycastResult.Instance or Workspace.Terrain
						Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
						if ParentToPart then
							local Scale = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterSize, Cast.UserData.ClientModule.ExplosionCraterSize)
							local Texture = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterTexture, Cast.UserData.ClientModule.ExplosionCraterTexture)
							local A0 = Instance.new("Attachment")
							local A1 = Instance.new("Attachment")
							local BeamClone = Beam:Clone()
							BeamClone.Width0 = Scale
							BeamClone.Width1 = Scale
							BeamClone.Texture = "rbxassetid://"..Texture[math.random(1,#Texture)]
							if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterPartColor, Cast.UserData.ClientModule.ExplosionCraterPartColor) then
								local HitPartColor = RaycastResult.Instance and RaycastResult.Instance.Color or Color3.fromRGB(255, 255, 255)
								if RaycastResult.Instance and RaycastResult.Instance:IsA("Terrain") then
									HitPartColor = Workspace.Terrain:GetMaterialColor(RaycastResult.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 = RaycastResult.Instance
							A1.Parent = RaycastResult.Instance
							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
							local VisibleTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterVisibleTime, Cast.UserData.ClientModule.ExplosionCraterVisibleTime)
							local FadeTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterFadeTime, Cast.UserData.ClientModule.ExplosionCraterFadeTime)
							Thread:Delay(VisibleTime, function()
								FadeBeam(A0, A1, BeamClone, Hole, FadeTime, Cast.UserData.Replicate)
							end)
						else
							Debris:AddItem(Hole, 5)
						end						
					end
				end
			end
		end
		
		if Cast.UserData.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(Cast.UserData.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()
							EmitParticle(Particle, Count)
							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 Cast.UserData.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 and TargetTorso then
						if TargetHumanoid.Health > 0 then
							if not HitHumanoids[TargetHumanoid] then
								if Cast.UserData.ClientModule.ExplosionKnockback then
									local Multipler = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget, Cast.UserData.ClientModule.ExplosionKnockbackMultiplierOnTarget)
									local DistanceFactor = HitDist / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionRadius, Cast.UserData.ClientModule.ExplosionRadius)
									DistanceFactor = 1 - DistanceFactor
									local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackPower, Cast.UserData.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, Cast.UserData.Character, Cast.UserData.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(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer, Cast.UserData.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
								local Part = RaycastResult and RaycastResult.Instance or HitPart
								Thread:Spawn(function()
									InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, Part, Part.Size, Cast.UserData.Misc, HitDist)
								end)
								if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
									Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, Part.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
								end
								HitHumanoids[TargetHumanoid] = true
							end   	
						end
					end
				elseif HitPart.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
					ShatterGlass:FireServer(HitPart, HitPart.Position, Direction)
				end
			end
		end)
	end
end

local function OnRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
	local CanBounce = Cast.UserData.CastBehavior.Hitscan and true or false
	local CurrentPosition = Cast:GetPosition()
	local CurrentVelocity = Cast:GetVelocity()
	local Acceleration = Cast.UserData.CastBehavior.Acceleration
	if not Cast.UserData.CastBehavior.Hitscan then
		Cast.UserData.SpinData.InitalTick = os.clock()
		Cast.UserData.SpinData.InitalAngularVelocity = RaycastResult.Normal:Cross(CurrentVelocity) / 0.2
		Cast.UserData.SpinData.InitalRotation = (Cast.RayInfo.CurrentCFrame - Cast.RayInfo.CurrentCFrame.p)
		Cast.UserData.SpinData.ProjectileOffset = 0.2 * RaycastResult.Normal		
		if CurrentVelocity.Magnitude > 0 then
			local NormalizeBounce = false
			local Position = Cast.RayInfo.RaycastHitbox and CurrentPosition or RaycastResult.Position
			if Cast.UserData.BounceData.BounceBetweenHumanoids then
				local Target = RaycastResult.Instance: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 not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
						table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
					end
				end
				local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, Position)
				if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
					local DesiredVector = (TrackedTorso.Position - Position).Unit
					if Cast.UserData.BounceData.PredictDirection then
						local Pos, Vel = DirectionPredictor(Position, TrackedTorso.Position, Vector3.new(), TrackedTorso.Velocity, Acceleration, (2 * TrackedTorso.Velocity) / 3, SegmentVelocity.Magnitude)
						if Pos and Vel then
							DesiredVector = Vel.Unit
						end
					end
					Cast:SetVelocity(DesiredVector * SegmentVelocity.Magnitude)
					Cast:SetPosition(Position)
				else
					NormalizeBounce = true
				end
			else
				NormalizeBounce = true
			end
			if NormalizeBounce then
				local Delta = Position - CurrentPosition
				local Fix = 1 - 0.001 / Delta.Magnitude
				Fix = Fix < 0 and 0 or Fix
				Cast:AddPosition(Fix * Delta + 0.05 * RaycastResult.Normal)
				local NewNormal = RaycastResult.Normal
				local NewVelocity = CurrentVelocity
				if Cast.UserData.BounceData.IgnoreSlope and (Acceleration ~= Vector3.new(0, 0, 0) and Acceleration.Y < 0) then
					local NewPosition = Cast:GetPosition()
					NewVelocity = Vector3.new(CurrentVelocity.X, -Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
					local Instance2, Position2, Normal2, Material2 = CastWithBlacklist(Cast, NewPosition, Vector3.new(0, 1, 0), Cast.UserData.IgnoreList, true)
					if Instance2 then
						NewVelocity = Vector3.new(CurrentVelocity.X, Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
					end	
					local X = math.deg(math.asin(RaycastResult.Normal.X))
					local Z = math.deg(math.asin(RaycastResult.Normal.Z))
					local FloorAngle = math.floor(math.max(X == 0 and Z or X, X == 0 and -Z or -X))
					NewNormal = FloorAngle > 0 and (FloorAngle >= Cast.UserData.BounceData.SlopeAngle and RaycastResult.Normal or Vector3.new(0, RaycastResult.Normal.Y, 0)) or RaycastResult.Normal
				end
				local NormalVelocity = Vector3.new().Dot(NewNormal, NewVelocity) * NewNormal
				local TanVelocity = NewVelocity - NormalVelocity
				local GeometricDeceleration
				local D1 = -Vector3.new().Dot(NewNormal, Acceleration)
				local D2 = -(1 + Cast.UserData.BounceData.BounceElasticity) * Vector3.new().Dot(NewNormal, NewVelocity)
				GeometricDeceleration = 1 - Cast.UserData.BounceData.FrictionConstant * (10 * (D1 < 0 and 0 or D1) * Cast.StateInfo.Delta + (D2 < 0 and 0 or D2)) / TanVelocity.Magnitude
				Cast:SetVelocity((GeometricDeceleration < 0 and 0 or GeometricDeceleration) * TanVelocity - Cast.UserData.BounceData.BounceElasticity * NormalVelocity)				
			end
			CanBounce = true	
		end
	else
		local NormalizeBounce = false
		if Cast.UserData.BounceData.BounceBetweenHumanoids then
			local Target = RaycastResult.Instance: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 not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
					table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
				end
			end
			local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, RaycastResult.Position)
			if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
				local DesiredVector = (TrackedTorso.Position - RaycastResult.Position).Unit
				Cast.RayInfo.ModifiedDirection = DesiredVector
			else
				NormalizeBounce = true
			end
		else
			NormalizeBounce = true
		end
		if NormalizeBounce then			
			local CurrentDirection = Cast.RayInfo.ModifiedDirection
			local NewDirection = CurrentDirection - (2 * CurrentDirection:Dot(RaycastResult.Normal) * RaycastResult.Normal)
			Cast.RayInfo.ModifiedDirection = NewDirection
		end
	end
	if CanBounce then
		if Cast.UserData.BounceData.CurrentBounces > 0 then
			Cast.UserData.BounceData.CurrentBounces -= 1
			local ShowEffects = CanShowEffects(RaycastResult.Position)			
			if Cast.UserData.BounceData.NoExplosionWhileBouncing then
				if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
					if Cast.UserData.Replicate then
						ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
					end
				else
					if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
						if ShowEffects then
							MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
						end
					else
						local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
						local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
						local Distance = (RaycastResult.Position - Origin).Magnitude
						local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
						if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
							if ShowEffects then
								MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
							end
							if Cast.UserData.Replicate then
								if TargetHumanoid.Health > 0 then							
									Thread:Spawn(function()
										InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
									end)
									if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
										Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
									end						
								end
							end
						else
							if ShowEffects then
								MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
							end
						end						
					end
				end	
			else
				OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
			end
		end		
	end
end

local function CanRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
	if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
		if Cast.UserData.BounceData.StopBouncingOn == "Object" then
			return false
		end
	else
		local Target = RaycastResult.Instance: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 Cast.UserData.BounceData.StopBouncingOn == "Humanoid" then
				return false
			end
		else
			if Cast.UserData.BounceData.StopBouncingOn == "Object" then
				return false
			end
		end		
	end
	if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.BounceData.SuperRicochet then
		return true
	else
		if Cast.UserData.BounceData.CurrentBounces > 0 then
			return true
		end		
	end
	return false
end

local function OnRayExited(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
	if not RayExit then
		return
	end
	if Cast.UserData.PenetrationData then
		if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
			local ShowEffects = CanShowEffects(RaycastResult.Position)
			if RaycastResult.Instance and RaycastResult.Instance.Parent then
				if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
					return
				else
					if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
						if ShowEffects then
							MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
						end
					else
						local Target = RaycastResult.Instance: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(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)						
							end	
						else
							if ShowEffects then
								MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
							end
						end						
					end			
				end	
			end		
		end		
	end
	if RaycastResult.Instance and RaycastResult.Instance.Parent then
		local vis = Cast:DbgVisualizeHit(CFrame.new(RaycastResult.Position), true)
		if (vis ~= nil) then vis.Color3 = Color3.fromRGB(13, 105, 172) end		
	end
end

local function CanRayPenetrate(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
	local ShowEffects = CanShowEffects(RaycastResult.Position)
	if RaycastResult.Instance and RaycastResult.Instance.Parent then
		if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
			return true
		else
			local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
			local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
			local TargetTool = RaycastResult.Instance:FindFirstAncestorOfClass("Tool")
			if (RaycastResult.Instance.Transparency > 0.75
				or RaycastResult.Instance.Name == "Missile"
				or RaycastResult.Instance.Name == "Handle"
				or RaycastResult.Instance.Name == "Effect"
				or RaycastResult.Instance.Name == "Bullet"
				or RaycastResult.Instance.Name == "Laser"
				or string.lower(RaycastResult.Instance.Name) == "water"
				or RaycastResult.Instance.Name == "Rail"
				or RaycastResult.Instance.Name == "Arrow"
				or (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.PenetrationData and table.find(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
				or TargetTool) then
				return true
			else
				if Cast.UserData.PenetrationData then
					if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
						if Cast.UserData.PenetrationData.PenetrationDepth <= 0 then
							return false
						end
					elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
						if Cast.UserData.PenetrationData.PenetrationAmount <= 0 then
							return false
						end
					end
					local MaxExtent = RaycastResult.Instance.Size.Magnitude * Direction
					local ExitHit, ExitPoint, ExitNormal, ExitMaterial = Workspace:FindPartOnRayWithWhitelist(Ray.new(RaycastResult.Position + MaxExtent, -MaxExtent), {RaycastResult.Instance}, Cast.RayInfo.Parameters.IgnoreWater)
					local Dist = (ExitPoint - RaycastResult.Position).Magnitude
					if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
						if Cast.UserData.Replicate then
							ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
						end
						if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
							local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
							Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
							return true
						end
					else
						if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
							if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
								if ShowEffects then
									MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
								end
								local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
								Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
								if ExitHit then
									OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
								end
								return true							
							end
						else
							local Distance = (RaycastResult.Position - Origin).Magnitude
							local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
							if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
								if not table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid) then
									table.insert(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
									if ShowEffects then
										MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
									end
									if Cast.UserData.Replicate then
										if TargetHumanoid.Health > 0 then							
											Thread:Spawn(function()
												InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
											end)
											if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
												Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
											end						
										end
									end
									if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
										local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
										Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
										if ExitHit then
											OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
										end
									elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
										Cast.UserData.PenetrationData.PenetrationAmount -= 1
									end
									if Cast.UserData.PenetrationData.PenetrationIgnoreDelay ~= math.huge then
										Thread:Delay(Cast.UserData.PenetrationData.PenetrationIgnoreDelay, function()
											local Index = table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
											if Index then
												table.remove(Cast.UserData.PenetrationData.HitHumanoids, Index)
											end	
										end)
									end
									return true
								end
							else
								if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
									if ShowEffects then
										MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
									end
									local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
									Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
									if ExitHit then
										OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
									end
									return true							
								end
							end								
						end
					end				
				end
			end
		end
	end
	return false
end

local function UpdateParticle(Cast, Position, LastPosition, W2)
	if Cast.UserData.BulletParticleData.MotionBlur then
		local T2 = os.clock()
		local P2 = CFrame.new().pointToObjectSpace(Camera.CFrame, W2)
		local V2
		if Cast.UserData.BulletParticleData.T0 then
			V2 = 2 / (T2 - Cast.UserData.BulletParticleData.T1) * (P2 - Cast.UserData.BulletParticleData.P1) - (P2 - Cast.UserData.BulletParticleData.P0) / (T2 - Cast.UserData.BulletParticleData.T0)
		else
			V2 = (P2 - Cast.UserData.BulletParticleData.P1) / (T2 - Cast.UserData.BulletParticleData.T1)
			Cast.UserData.BulletParticleData.V1 = V2
		end
		Cast.UserData.BulletParticleData.T0, Cast.UserData.BulletParticleData.V0, Cast.UserData.BulletParticleData.P0 = Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1
		Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1 = T2, V2, P2
		local Dt = Cast.UserData.BulletParticleData.T1 - Cast.UserData.BulletParticleData.T0
		local M0 = Cast.UserData.BulletParticleData.V0.Magnitude
		local M1 = Cast.UserData.BulletParticleData.V1.Magnitude
		Cast.UserData.BulletParticleData.Attachment0.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P0
		Cast.UserData.BulletParticleData.Attachment1.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P1
		if M0 > 1.0E-8 then
			Cast.UserData.BulletParticleData.Attachment0.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V0 / M0)
		end
		if M1 > 1.0E-8 then
			Cast.UserData.BulletParticleData.Attachment1.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V1 / M1)
		end
		local Dist0 = -Cast.UserData.BulletParticleData.P0.Z
		local Dist1 = -Cast.UserData.BulletParticleData.P1.Z
		if Dist0 < 0 then
			Dist0 = 0
		end
		if Dist1 < 0 then
			Dist1 = 0
		end
		local W0 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist0
		local W1 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist1
		local L = ((Cast.UserData.BulletParticleData.P1 - Cast.UserData.BulletParticleData.P0) * Vector3.new(1, 1, 0)).Magnitude
		local Tr = 1 - 4 * Cast.UserData.BulletParticleData.BulletSize * Cast.UserData.BulletParticleData.BulletSize / ((W0 + W1) * (2 * L + W0 + W1)) * Cast.UserData.BulletParticleData.BulletBrightness
		for _, effect in next, Cast.UserData.BulletParticleData.Effects do
			effect.CurveSize0 = Dt / 3 * M0
			effect.CurveSize1 = Dt / 3 * M1
			effect.Width0 = W0
			effect.Width1 = W1
			effect.Transparency = NumberSequence.new(Tr)
		end
	else
		if (Position - LastPosition).Magnitude > 0 then
			local Rotation = CFrame.new(LastPosition, Position) - LastPosition
			local Offset = CFrame.Angles(0, math.pi / 2, 0)
			Cast.UserData.BulletParticleData.Attachment0.CFrame = CFrame.new(Position) * Rotation * Offset
			Cast.UserData.BulletParticleData.Attachment1.CFrame = CFrame.new(LastPosition, Position) * Offset
		end					
	end
end

local function OnRayUpdated(Cast, LastSegmentOrigin, SegmentOrigin, SegmentDirection, Length, SegmentVelocity, CosmeticBulletObject)
	Cast.UserData.LastSegmentOrigin = LastSegmentOrigin
	Cast.UserData.SegmentOrigin = SegmentOrigin
	Cast.UserData.SegmentDirection = SegmentDirection
	Cast.UserData.SegmentVelocity = SegmentVelocity
	local Tick = os.clock() - Cast.UserData.SpinData.InitalTick
	if Cast.UserData.UpdateData.UpdateRayInExtra then
		if Cast.UserData.UpdateData.ExtraRayUpdater then
			Cast.UserData.UpdateData.ExtraRayUpdater(Cast, Cast.StateInfo.Delta)
		end
	end
	if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.HomeData.Homing then
		local CurrentPosition = Cast:GetPosition()
		local CurrentVelocity = Cast:GetVelocity()
		if Cast.UserData.HomeData.LockOnOnHovering then
			if Cast.UserData.HomeData.LockedEntity then
				local TargetHumanoid = Cast.UserData.HomeData.LockedEntity:FindFirstChildOfClass("Humanoid")
				if TargetHumanoid and TargetHumanoid.Health > 0 then
					local TargetTorso = Cast.UserData.HomeData.LockedEntity:FindFirstChild("HumanoidRootPart") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("Torso") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("UpperTorso")
					local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
					local CurrentVector = CurrentVelocity.Unit
					local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
					if AngularDifference > 0 then
						local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
						local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
						Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
					end
				end
			end
		else
			local TargetEntity, TargetHumanoid, TargetTorso = FindNearestEntity(Cast, CurrentPosition)
			if TargetEntity and TargetHumanoid and TargetTorso and TargetHumanoid.Health > 0 then
				local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
				local CurrentVector = CurrentVelocity.Unit
				local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
				if AngularDifference > 0 then
					local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
					local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
					Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
				end
			end
		end
	end
	local TravelCFrame
	if Cast.UserData.SpinData.CanSpinPart then
		if not Cast.UserData.CastBehavior.Hitscan then
			local Position = (SegmentOrigin + Cast.UserData.SpinData.ProjectileOffset)
			if Cast.UserData.BounceData.SuperRicochet then
				TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
			else
				if Cast.UserData.BounceData.CurrentBounces > 0 then
					TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
				else
					TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
				end
			end
		else
			TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
		end
	else
		TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity)
	end
	Cast.RayInfo.CurrentCFrame = TravelCFrame
	if Cast.UserData.BulletParticleData then
		UpdateParticle(Cast, SegmentOrigin, Cast.UserData.LastPosition, SegmentOrigin)
	end
	if Cast.UserData.LaserData.LaserTrailEnabled then
		if Cast.StateInfo.Delta > 0 then
			local Width = Cast.UserData.LaserData.LaserTrailWidth
			local Height = Cast.UserData.LaserData.LaserTrailHeight
			local TrailSegment = Miscs[Cast.UserData.LaserData.LaserTrailShape.."Segment"]:Clone()
			if Cast.UserData.LaserData.RandomizeLaserColorIn ~= "None" then
				if Cast.UserData.LaserData.RandomizeLaserColorIn == "Whole" then
					TrailSegment.Color = Cast.UserData.LaserData.RandomLaserColor
				elseif Cast.UserData.LaserData.RandomizeLaserColorIn == "Segment" then
					TrailSegment.Color = Color3.new(math.random(), math.random(), math.random())
				end
			else
				TrailSegment.Color = Cast.UserData.LaserData.LaserTrailColor
			end
			TrailSegment.Material = Cast.UserData.LaserData.LaserTrailMaterial
			TrailSegment.Reflectance = Cast.UserData.LaserData.LaserTrailReflectance
			TrailSegment.Transparency = Cast.UserData.LaserData.LaserTrailTransparency
			TrailSegment.Size = Cast.UserData.LaserData.LaserTrailShape == "Cone" and Vector3.new(Width, (SegmentOrigin - LastSegmentOrigin).Magnitude, Height) or Vector3.new((SegmentOrigin - LastSegmentOrigin).Magnitude, Height, Width)
			TrailSegment.CFrame = CFrame.new((LastSegmentOrigin + SegmentOrigin) * 0.5, SegmentOrigin) * (Cast.UserData.LaserData.LaserTrailShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
			TrailSegment.Parent = Camera
			table.insert(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
			if Cast.UserData.LaserData.UpdateLaserTrail then
				Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
			end
			Thread:Delay(Cast.UserData.LaserData.LaserTrailVisibleTime, function()
				if Cast.UserData.LaserData.LaserTrailFadeTime > 0 then
					local DesiredSize = TrailSegment.Size * (Cast.UserData.LaserData.ScaleLaserTrail and Vector3.new(1, Cast.UserData.LaserData.LaserTrailScaleMultiplier, Cast.UserData.LaserData.LaserTrailScaleMultiplier) or Vector3.new(1, 1, 1))
					local Tween = TweenService:Create(TrailSegment, TweenInfo.new(Cast.UserData.LaserData.LaserTrailFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
					Tween:Play()
					Tween.Completed:Wait()
					if TrailSegment then
						local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
						if Index then
							table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
							if Cast.UserData.LaserData.UpdateLaserTrail then
								Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
							end
						end
						TrailSegment:Destroy()
					end
				else
					if TrailSegment then
						local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
						if Index then
							table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
							if Cast.UserData.LaserData.UpdateLaserTrail then
								Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
							end
						end
						TrailSegment:Destroy()
					end
				end
			end)			
		end
	end
	if Cast.UserData.LightningData.LightningBoltEnabled then
		if Cast.StateInfo.Delta > 0 then
			local Wideness = Cast.UserData.LightningData.BoltWideness
			local Width = Cast.UserData.LightningData.BoltWidth
			local Height = Cast.UserData.LightningData.BoltHeight
			for _, v in ipairs(Cast.UserData.LightningData.BoltCFrameTable) do
				local Cache
				if Cast.UserData.LightningData.BoltShape == "Block" then
					Cache = BlockSegCache
				elseif Cast.UserData.LightningData.BoltShape == "Cylinder" then
					Cache = CylinderSegCache
				elseif Cast.UserData.LightningData.BoltShape == "Cone" then
					Cache = ConeSegCache
				end
				if Cache then
					local Start = (CFrame.new(SegmentOrigin, SegmentOrigin + SegmentDirection) * v).p
					local End = (CFrame.new(LastSegmentOrigin, LastSegmentOrigin + SegmentDirection) * v).p
					local Distance = (End - Start).Magnitude
					local Pos = Start
					for i = 0, Distance, 10 do
						local FakeDistance = CFrame.new(Start, End) * CFrame.new(0, 0, -i - 10) * CFrame.new(-2 + (math.random() * Wideness), -2 + (math.random() * Wideness), -2 + (math.random() * Wideness))
						local BoltSegment = Cache:GetPart()
						if Cast.UserData.LightningData.RandomizeBoltColorIn ~= "None" then
							if Cast.UserData.LightningData.RandomizeBoltColorIn == "Whole" then
								BoltSegment.Color = Cast.UserData.LightningData.RandomBoltColor
							elseif Cast.UserData.LightningData.RandomizeBoltColorIn == "Segment" then
								BoltSegment.Color = Color3.new(math.random(), math.random(), math.random())
							end
						else
							BoltSegment.Color = Cast.UserData.LightningData.BoltColor
						end
						BoltSegment.Material = Cast.UserData.LightningData.BoltMaterial
						BoltSegment.Reflectance = Cast.UserData.LightningData.BoltReflectance
						BoltSegment.Transparency = Cast.UserData.LightningData.BoltTransparency						
						if i + 10 > Distance then
							BoltSegment.CFrame = CFrame.new(Pos, End) * CFrame.new(0, 0, -(Pos - End).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
						else
							BoltSegment.CFrame = CFrame.new(Pos, FakeDistance.p) * CFrame.new(0, 0, -(Pos - FakeDistance.p).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
						end
						if i + 10 > Distance then
							BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - End).Magnitude, Height) or Vector3.new((Pos - End).Magnitude, Height, Width)
						else
							BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - FakeDistance.p).Magnitude, Height) or Vector3.new((Pos - FakeDistance.p).Magnitude, Height, Width)
						end
						Thread:Delay(Cast.UserData.LightningData.BoltVisibleTime, function()
							if Cast.UserData.LightningData.BoltFadeTime > 0 then
								local DesiredSize = BoltSegment.Size * (Cast.UserData.LightningData.ScaleBolt and Vector3.new(1, Cast.UserData.LightningData.BoltScaleMultiplier, Cast.UserData.LightningData.BoltScaleMultiplier) or Vector3.new(1, 1, 1))
								local Tween = TweenService:Create(BoltSegment, TweenInfo.new(Cast.UserData.LightningData.BoltFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
								Tween:Play()
								Tween.Completed:Wait()
								if BoltSegment ~= nil then
									Cache:ReturnPart(BoltSegment)
								end
							else
								if BoltSegment ~= nil then
									Cache:ReturnPart(BoltSegment)
								end								
							end
						end)
						Pos = FakeDistance.p
					end					
				end
			end
		end
	end
	if not Cast.UserData.Replicate and Cast.UserData.ClientModule.WhizSoundEnabled then
		if not Cast.UserData.Whizzed then	
			local Mag = (Camera.CFrame.p - SegmentOrigin).Magnitude --(Camera.CFrame.p - CosmeticBulletObject.Position).Magnitude		
			if Mag < Cast.UserData.ClientModule.WhizDistance then
				local WhizSound = Instance.new("Sound")
				WhizSound.SoundId = "rbxassetid://"..Cast.UserData.ClientModule.WhizSoundIDs[math.random(1, #Cast.UserData.ClientModule.WhizSoundIDs)]
				WhizSound.Volume = Cast.UserData.ClientModule.WhizSoundVolume
				WhizSound.PlaybackSpeed = Random.new():NextNumber(Cast.UserData.ClientModule.WhizSoundPitchMin, Cast.UserData.ClientModule.WhizSoundPitchMax)
				WhizSound.Name = "WhizSound"
				WhizSound.Parent = SoundService				
				WhizSound:Play()
				Debris:AddItem(WhizSound, WhizSound.TimeLength / WhizSound.PlaybackSpeed)
				Cast.UserData.Whizzed = true
			end
		end
	end
	Cast.UserData.LastPosition = SegmentOrigin
	if CosmeticBulletObject == nil then
		return
	end
	CosmeticBulletObject.CFrame = TravelCFrame
end

local function OnRayTerminated(Cast, RaycastResult, IsDecayed)
	if Cast.UserData.LaserData.UpdateLaserTrail then
		Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer, true)
	end
	if Cast.UserData.BulletParticleData then
		Cast.UserData.BulletParticleData.Attachment0:Destroy()
		Cast.UserData.BulletParticleData.Attachment1:Destroy()
		for _, effect in next, Cast.UserData.BulletParticleData.Effects do
			effect:Destroy()
		end
	end
	local CosmeticBulletObject = Cast.RayInfo.CosmeticBulletObject
	if CosmeticBulletObject ~= nil then	
		local CurrentPosition = Cast:GetPosition()
		local CurrentVelocity = Cast:GetVelocity()
		if IsDecayed then
			if Cast.UserData.DebrisData.DecayProjectile then
				if DebrisCounts <= MaxDebrisCounts then
					DebrisCounts += 1
					local DecayProjectile = CosmeticBulletObject:Clone()
					DecayProjectile.Name = "DecayProjectile"
					DecayProjectile.CFrame = CosmeticBulletObject.CFrame
					DecayProjectile.Anchored = Cast.UserData.DebrisData.AnchorDecay
					DecayProjectile.CanCollide = Cast.UserData.DebrisData.CollideDecay
					if not DecayProjectile.Anchored then
						if Cast.UserData.DebrisData.VelocityInfluence then
							DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * CurrentVelocity.Magnitude
						else
							DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * Cast.UserData.DebrisData.DecayVelocity
						end
					end
					for _, v in pairs(DecayProjectile:GetDescendants()) do
						if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
							v.Enabled = false
						elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
							v.Enabled = false
						elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
							v.Enabled = false
						elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
							v.Enabled = false
						elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
							v:Stop()
						end
					end
					DecayProjectile.Parent = Camera
					Thread:Delay(5, function() --10
						if DecayProjectile then
							DecayProjectile:Destroy()
						end
						DebrisCounts -= 1
					end)
				end
			end
		else
			if RaycastResult then
				local HitPointObjectSpace = RaycastResult.Instance.CFrame:pointToObjectSpace(RaycastResult.Position)
				if Cast.UserData.DebrisData.DebrisProjectile then
					if DebrisCounts <= MaxDebrisCounts then
						DebrisCounts += 1
						local DebrisProjectile = CosmeticBulletObject:Clone()
						DebrisProjectile.Name = "DebrisProjectile"
						DebrisProjectile.CFrame = Cast.UserData.DebrisData.NormalizeDebris and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or (RaycastResult.Instance.CFrame * CFrame.new(HitPointObjectSpace, HitPointObjectSpace + RaycastResult.Instance.CFrame:vectorToObjectSpace(Cast.UserData.SegmentVelocity.Unit))) --CosmeticBulletObject.CFrame
						DebrisProjectile.Anchored = Cast.UserData.DebrisData.AnchorDebris
						DebrisProjectile.CanCollide = Cast.UserData.DebrisData.CollideDebris
						if not DebrisProjectile.Anchored and Cast.UserData.DebrisData.BounceDebris then
							local Direction = DebrisProjectile.CFrame.LookVector
							local Reflect = Direction - (2 * Direction:Dot(RaycastResult.Normal) * RaycastResult.Normal)
							DebrisProjectile.Velocity = Reflect * (Cast.UserData.DebrisData.BounceVelocity * (CurrentVelocity.Magnitude / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.BulletSpeed, Cast.UserData.ClientModule.BulletSpeed)))
							DebrisProjectile.CFrame = CFrame.new(DebrisProjectile.Position, DebrisProjectile.Position + DebrisProjectile.Velocity)	
						end
						for _, v in pairs(DebrisProjectile:GetDescendants()) do
							if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
								v.Enabled = false
							elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
								v.Enabled = false
							elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
								v.Enabled = false
							elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
								v.Enabled = false
							elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
								v:Stop()
							end
						end
						DebrisProjectile.Parent = Camera
						Thread:Delay(5, function() --10
							if DebrisProjectile then
								DebrisProjectile:Destroy()
							end
							DebrisCounts -= 1
						end)
					end
				end
			end
		end
		CosmeticBulletObject.Transparency = 1
		for _, v in pairs(CosmeticBulletObject:GetDescendants()) do
			if v:IsA("ParticleEmitter") or v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("BillboardGui") or v:IsA("SurfaceGui") then
				v.Enabled = false
			elseif v:IsA("Sound") then
				v:Stop()
			elseif v:IsA("Decal") or v:IsA("Texture") or v:IsA("BasePart") then
				v.Transparency = 1
			end
		end
		if Cast.UserData.CastBehavior.CosmeticBulletProvider ~= nil then
			--Thread:Delay(5, function() -- 10
				if CosmeticBulletObject ~= nil then
					Cast.UserData.CastBehavior.CosmeticBulletProvider:ReturnPart(CosmeticBulletObject)
				end
			--end)
		else
			Debris:AddItem(CosmeticBulletObject, 5) -- 10
		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)
	end
	local ShowEffects = CanShowEffects(Position)
	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, VMHandle, ClientModule, CLDirections, SVDirections, FirePointObject, MuzzlePointObject, Misc, Replicate)
	if ClientModule and Tool and Handle then
		if FirePointObject then
			if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
				return
			end
		else
			return
		end
						
		if Replicate then 
			VisualizeBullet:FireServer(Tool, Handle, VMHandle, ClientModule, CLDirections, SVDirections, FirePointObject, MuzzlePointObject, Misc)
		end
		
		local MuzzleObject = MuzzlePointObject
		local Directions = SVDirections

		if VMHandle ~= nil then
			MuzzleObject = VMHandle:FindFirstChild("GunMuzzlePoint"..ClientModule.ModuleName)
			Directions = CLDirections
		end
		
		if MuzzleObject then
			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 = MuzzleObject
						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 = MuzzleObject
				Debris:AddItem(Light, ClientModule.VisibleTime)
			end			
		end
		
		local Character = Tool.Parent
		local IgnoreList = {Camera, Tool, Character}
		local CastParams = RaycastParams.new()
		CastParams.IgnoreWater = true
		CastParams.FilterType = Enum.RaycastFilterType.Blacklist
		CastParams.FilterDescendantsInstances = IgnoreList
		local RegionParams = OverlapParams.new()
		RegionParams.FilterType = Enum.RaycastFilterType.Blacklist
		RegionParams.FilterDescendantsInstances = IgnoreList
		RegionParams.MaxParts = 0
		RegionParams.CollisionGroup = "Default"
		
		ShootId += 1
		
		local LaserTrails = {}
		local UpdateLaserTrail
		local LaserTrailEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailEnabled, ClientModule.LaserTrailEnabled)		
		local DamageableLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DamageableLaserTrail, ClientModule.DamageableLaserTrail)
		if Replicate then
			if LaserTrailEnabled and DamageableLaserTrail then
				UpdateLaserTrail = Instance.new("BindableEvent")
				UpdateLaserTrail.Name = "UpdateLaserTrail_"..HttpService:GenerateGUID()
			end
		end
		
		for _, Direction in pairs(Directions) do
			if FirePointObject then
				if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
					return
				end
			else
				return
			end 
			
			local CFrm = FirePointObject.WorldCFrame
			local Origin, Dir = FirePointObject.WorldPosition, Direction

			if VMHandle ~= nil then
				CFrm = VMHandle:FindFirstChild("GunFirePoint"..ClientModule.ModuleName).WorldCFrame
				Origin = VMHandle:FindFirstChild("GunFirePoint"..ClientModule.ModuleName).WorldPosition
			end

			local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart", 1)
			local TipCFrame = CFrm
			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 CosmeticPartProvider
			local ProjectileContainer
			local ProjectileType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ProjectileType, ClientModule.ProjectileType)
			if ProjectileType ~= "None" then
				local Projectile = Projectiles:FindFirstChild(ProjectileType)
				if Projectile then
					local Exist2 = false
					for _, v in pairs(PartCacheStorage) do
						if v.ProjectileName == Projectile.Name then
							Exist2 = true
							ProjectileContainer = Camera:FindFirstChild("ProjectileContainer_("..Projectile.Name..")")
							CosmeticPartProvider = v.CosmeticPartProvider
							break
						end
					end
					if not Exist2 then
						ProjectileContainer = Instance.new("Folder")
						ProjectileContainer.Name = "ProjectileContainer_("..Projectile.Name..")"
						ProjectileContainer.Parent = Camera
						CosmeticPartProvider = PartCache.new(Projectile, 100, ProjectileContainer)
						table.insert(PartCacheStorage, {
							ProjectileName = Projectile.Name,
							CosmeticPartProvider = CosmeticPartProvider
						})
					end					
				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) then
				PenetrationData = {
					PenetrationDepth = PenetrationDepth,
					PenetrationAmount = PenetrationAmount,
					PenetrationIgnoreDelay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationIgnoreDelay, ClientModule.PenetrationIgnoreDelay),
					HitHumanoids = {},
				}
			end

			local SpinX = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinX, ClientModule.SpinX)
			local SpinY = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinY, ClientModule.SpinY)
			local SpinZ = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinZ, ClientModule.SpinZ)

			local BulletParticleData
			if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletParticle, ClientModule.BulletParticle) then
				local BulletType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletType, ClientModule.BulletType)
				if BulletType ~= "None" then
					local Attachment0 = Bullets[BulletType].Attachment0:Clone()
					local Attachment1 = Bullets[BulletType].Attachment1:Clone()
					local Effects = {}
					Attachment0.Parent = Workspace.Terrain
					Attachment1.Parent = Workspace.Terrain
					for _, effect in next, Bullets[BulletType]:GetChildren() do
						if effect:IsA("Beam") or effect:IsA("Trail") then
							local eff = effect:Clone()
							eff.Attachment0 = Attachment0 --Attachment1
							eff.Attachment1 = Attachment1 --Attachment0
							eff.Parent = Workspace.Terrain
							table.insert(Effects, eff)
						end
					end
					BulletParticleData = {
						T0 = nil,
						P0 = nil,
						V0 = nil,
						T1 = os.clock(),
						P1 = CFrame.new().pointToObjectSpace(Camera.CFrame, Origin),
						V1 = nil,
						Attachment0 = Attachment0,
						Attachment1 = Attachment1,
						Effects = Effects,
						MotionBlur = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.MotionBlur, ClientModule.MotionBlur),
						BulletSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSize, ClientModule.BulletSize),
						BulletBloom = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBloom, ClientModule.BulletBloom),
						BulletBrightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBrightness, ClientModule.BulletBrightness),
					}
				end	
			end

			local CastBehavior = FastCast.newBehavior()
			CastBehavior.RaycastParams = CastParams
			CastBehavior.TravelType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TravelType, ClientModule.TravelType)
			CastBehavior.MaxDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Range, ClientModule.Range)
			CastBehavior.Lifetime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Lifetime, ClientModule.Lifetime)
			CastBehavior.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default

			--CastBehavior.CosmeticBulletTemplate = CosmeticBullet -- Uncomment if you just want a simple template part and aren't using PartCache
			CastBehavior.CosmeticBulletProvider = CosmeticPartProvider -- Comment out if you aren't using PartCache

			CastBehavior.CosmeticBulletContainer = ProjectileContainer
			CastBehavior.Acceleration = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Acceleration, ClientModule.Acceleration)
			CastBehavior.AutoIgnoreContainer = false
			CastBehavior.HitEventOnTermination = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitEventOnTermination, ClientModule.HitEventOnTermination)
			CastBehavior.CanPenetrateFunction = CanRayPenetrate
			CastBehavior.CanHitFunction = CanRayHit

			local RaycastHitbox = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitbox, ClientModule.RaycastHitbox)
			local RaycastHitboxData = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitboxData, ClientModule.RaycastHitboxData)
			CastBehavior.RaycastHitbox = (RaycastHitbox and #RaycastHitboxData > 0) and RaycastHitboxData or nil
			CastBehavior.CurrentCFrame = CFrame.new(Origin, Origin + Dir)
			CastBehavior.ModifiedDirection = CFrame.new(Origin, Origin + Dir).LookVector

			CastBehavior.Hitscan = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitscanMode, ClientModule.HitscanMode)
			
			local LaserTrailId = HttpService:GenerateGUID()
			if Replicate then
				if LaserTrailEnabled and DamageableLaserTrail then
					table.insert(LaserTrails, {
						Id = LaserTrailId,
						LaserContainer = {},
						HitHumanoids = {},
						Terminate = false,
					})
				end
			end
			
			local BoltCFrameTable = {}
			local LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled)
			if LightningBoltEnabled then
				local BoltRadius = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltRadius, ClientModule.BoltRadius)
				for i = 1, AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltCount, ClientModule.BoltCount) do
					if i == 1 then
						table.insert(BoltCFrameTable, CFrame.new(0, 0, 0))
					else
						table.insert(BoltCFrameTable, CFrame.new(math.random(-BoltRadius, BoltRadius), math.random(-BoltRadius, BoltRadius), 0))
					end
				end
			end
			
			CastBehavior.UserData = {
				ShootId = ShootId,
				Tool = Tool,
				Character = Character,
				ClientModule = ClientModule,
				Misc = Misc,
				Replicate = Replicate,
				PenetrationData = PenetrationData,
				BulletParticleData = BulletParticleData,
				LaserData = {
					LaserTrailEnabled = LaserTrailEnabled,					
					LaserTrailWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailWidth, ClientModule.LaserTrailWidth),
					LaserTrailHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailHeight, ClientModule.LaserTrailHeight),					
					LaserTrailColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailColor, ClientModule.LaserTrailColor),
					RandomizeLaserColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeLaserColorIn, ClientModule.RandomizeLaserColorIn),
					LaserTrailMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailMaterial, ClientModule.LaserTrailMaterial),
					LaserTrailShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailShape, ClientModule.LaserTrailShape),
					LaserTrailReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailReflectance, ClientModule.LaserTrailReflectance),
					LaserTrailTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailTransparency, ClientModule.LaserTrailTransparency),
					LaserTrailVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailVisibleTime, ClientModule.LaserTrailVisibleTime),
					LaserTrailFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailFadeTime, ClientModule.LaserTrailFadeTime),
					ScaleLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleLaserTrail, ClientModule.ScaleLaserTrail),
					LaserTrailScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailScaleMultiplier, ClientModule.LaserTrailScaleMultiplier),
					RandomLaserColor = Color3.new(math.random(), math.random(), math.random()),
					LaserTrailId = LaserTrailId,
					UpdateLaserTrail = UpdateLaserTrail,
					LaserTrailContainer = {},
				},
				LightningData = {
					LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled),
					BoltWideness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWideness, ClientModule.BoltWideness),
					BoltWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWidth, ClientModule.BoltWidth),
					BoltHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltHeight, ClientModule.BoltHeight),
					BoltColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltColor, ClientModule.BoltColor),
					RandomizeBoltColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeBoltColorIn, ClientModule.RandomizeBoltColorIn),
					BoltMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltMaterial, ClientModule.BoltMaterial),
					BoltShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltShape, ClientModule.BoltShape),
					BoltReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltReflectance, ClientModule.BoltReflectance),
					BoltTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltTransparency, ClientModule.BoltTransparency),
					BoltVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltVisibleTime, ClientModule.BoltVisibleTime),
					BoltFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltFadeTime, ClientModule.BoltFadeTime),
					ScaleBolt = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleBolt, ClientModule.ScaleBolt),
					BoltScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltScaleMultiplier, ClientModule.BoltScaleMultiplier),
					RandomBoltColor = Color3.new(math.random(), math.random(), math.random()),
					BoltCFrameTable = BoltCFrameTable,
				},
				SpinData = {
					CanSpinPart = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CanSpinPart, ClientModule.CanSpinPart),
					SpinX = SpinX,
					SpinY = SpinY,
					SpinZ = SpinZ,
					InitalTick = os.clock(),
					InitalAngularVelocity = Vector3.new(SpinX, SpinY, SpinZ),
					InitalRotation = (CastBehavior.CurrentCFrame - CastBehavior.CurrentCFrame.p),
					ProjectileOffset = Vector3.new(),
				},
				DebrisData = {
					DebrisProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DebrisProjectile, ClientModule.DebrisProjectile),
					AnchorDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDebris, ClientModule.AnchorDebris),
					CollideDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDebris, ClientModule.CollideDebris),
					NormalizeDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NormalizeDebris, ClientModule.NormalizeDebris),
					BounceDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceDebris, ClientModule.BounceDebris),
					BounceVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceVelocity, ClientModule.BounceVelocity),

					DecayProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayProjectile, ClientModule.DecayProjectile),
					AnchorDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDecay, ClientModule.AnchorDecay),
					CollideDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDecay, ClientModule.CollideDecay),
					DecayVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayVelocity, ClientModule.DecayVelocity),
					VelocityInfluence = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.VelocityInfluence, ClientModule.VelocityInfluence),

					DisableDebrisContents = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DisableDebrisContents, ClientModule.DisableDebrisContents),	
				},
				BounceData = {
					CurrentBounces = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RicochetAmount, ClientModule.RicochetAmount),
					BounceElasticity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceElasticity, ClientModule.BounceElasticity),
					FrictionConstant = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.FrictionConstant, ClientModule.FrictionConstant),
					IgnoreSlope = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.IgnoreSlope, ClientModule.IgnoreSlope),
					SlopeAngle = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SlopeAngle, ClientModule.SlopeAngle),
					BounceHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceHeight, ClientModule.BounceHeight),
					NoExplosionWhileBouncing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NoExplosionWhileBouncing, ClientModule.NoExplosionWhileBouncing),
					StopBouncingOn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.StopBouncingOn, ClientModule.StopBouncingOn),
					SuperRicochet = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SuperRicochet, ClientModule.SuperRicochet),
					BounceBetweenHumanoids = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceBetweenHumanoids, ClientModule.BounceBetweenHumanoids),
					PredictDirection = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PredictDirection, ClientModule.PredictDirection),					
					BouncedHumanoids = {},
				},
				HomeData = {
					Homing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Homing, ClientModule.Homing),
					HomingDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomingDistance, ClientModule.HomingDistance),
					TurnRatePerSecond = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TurnRatePerSecond, ClientModule.TurnRatePerSecond),
					HomeThroughWall = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomeThroughWall, ClientModule.HomeThroughWall),
					LockOnOnHovering = ClientModule.LockOnOnHovering,
					LockedEntity = Misc.LockedEntity,
				},
				UpdateData = {
					UpdateRayInExtra = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.UpdateRayInExtra, ClientModule.UpdateRayInExtra),
					ExtraRayUpdater = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExtraRayUpdater, ClientModule.ExtraRayUpdater),
				},
				IgnoreList = IgnoreList,
				LastSegmentOrigin = Vector3.new(),
				SegmentOrigin = Vector3.new(),
				SegmentDirection = Vector3.new(),
				SegmentVelocity = Vector3.new(),
				LastPosition = Origin,
				CastBehavior = CastBehavior,
				Whizzed = false,
			}

			local Simulate = Caster:Fire(Origin, Dir, ModifiedBulletSpeed, CastBehavior)
		end
		
		if Replicate then
			if LaserTrailEnabled and DamageableLaserTrail then
				if UpdateLaserTrail then
					UpdateLaserTrail.Event:Connect(function(Id, LaserContainer, Terminate)
						for _, v in pairs(LaserTrails) do
							if v.Id == Id then
								v.LaserContainer = LaserContainer
								if Terminate then
									v.Terminate = true
								end
								break
							end
						end
					end)
				end
				local Connection
				Connection = RunService.Heartbeat:Connect(function(dt)
					if #LaserTrails <= 0 then
						if UpdateLaserTrail then
							UpdateLaserTrail:Destroy()
						end
						if Connection then
							Connection:Disconnect()
							Connection = nil
						end
					else
						for i, v in next, LaserTrails, nil do
							local Terminated = false
							if v.Terminate then
								if #v.LaserContainer <= 0 then
									Terminated = true
									table.remove(LaserTrails, i)
								end
							end
							if not Terminated then
								for _, vv in pairs(v.LaserContainer) do
									if vv then
										local TouchingParts = Workspace:GetPartsInPart(vv, RegionParams)
										for _, part in pairs(TouchingParts) do
											if part and part.Parent then
												local Target = part:FindFirstAncestorOfClass("Model")
												local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
												local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or part.Parent:FindFirstChild("Head"))
												if TargetHumanoid and TargetHumanoid.Parent ~= Character and TargetTorso then
													if TargetHumanoid.Health > 0 then														
														if not table.find(v.HitHumanoids, TargetHumanoid) then
															table.insert(v.HitHumanoids, TargetHumanoid)
															Thread:Spawn(function()
																InflictTarget:InvokeServer("GunLaser", Tool, ClientModule, TargetHumanoid, TargetTorso, part, part.Size, Misc)
															end)
															if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
																Tool.GunClient.MarkerEvent:Fire(ClientModule, false)
															end
															if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailConstantDamage, ClientModule.LaserTrailConstantDamage) then
																Thread:Delay(AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailDamageRate, ClientModule.LaserTrailDamageRate), function()
																	local Index = table.find(v.HitHumanoids, TargetHumanoid)
																	if Index then
																		table.remove(v.HitHumanoids, Index)
																	end
																end)
															end
														end	
													end
												end	
											end
										end
									end
								end								
							end
						end
					end
				end)				
			end			
		end
	end
end

Caster.RayFinalHit:Connect(OnRayFinalHit)
Caster.RayHit:Connect(OnRayHit)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)

return ProjectileHandler
