local a=game.Players.LocalPlayer local Z=script.Parent.Parent local T=Z:WaitForChild("\072\105\116\080\108\097\121\101\114\115")local D=Z:WaitForChild("\068\105\114\101\099\116\072\105\116\080\108\097\121\101\114")local U=Z.Configuration function RocketManager.BindRocketEvents(h,L)local g=false L.PrimaryPart.Touched:connect(function(h)if not h:IsDescendantOf(a.Character)and not g then g=true L.PrimaryPart.LocalTransparencyModifier=1 Z.RocketHit:FireServer(L,L.PrimaryPart.Position)local a=Instance.new("\080\097\114\116")a.Anchored=true a.CanCollide=false a.Position=L.PrimaryPart.Position a.FormFactor=Enum.FormFactor.Custom a.Shape=Enum.PartType.Ball a.Size=(Vector3.new(1,1,1)*U.BlastRadius.Value)*2 a.Parent=game.Workspace a.CanCollide=true local V={}local z=a:GetTouchingParts()a:Destroy()local G=Players:GetPlayerFromCharacter(h.Parent)if G then D:FireServer(G.userId)end for a,Z in ipairs(z)do local T=Players:GetPlayerFromCharacter(Z.Parent)if T and not V[tostring(T.userId)]then V[tostring(T.userId)]=true end end T:FireServer(V)end end)end return RocketManager

local Player = game.Players.LocalPlayer
local Tool = script.Parent.Parent
local HitPlayer = Tool:WaitForChild('HitPlayers')
local DirectHitPlayer = Tool:WaitForChild('DirectHitPlayer')
local Configurations = Tool.Configuration

function RocketManager:BindRocketEvents(rocket)
	local exploded = false
	
	rocket.PrimaryPart.Touched:connect(function(otherPart)
		if not otherPart:IsDescendantOf(Player.Character) and not exploded then
			exploded = true
			rocket.PrimaryPart.LocalTransparencyModifier = 1
			Tool.RocketHit:FireServer(rocket, rocket.PrimaryPart.Position)
			local collision = Instance.new('Part')
			collision.Anchored = true
			collision.CanCollide = false
			collision.Position = rocket.PrimaryPart.Position
			collision.FormFactor = Enum.FormFactor.Custom
			collision.Shape = Enum.PartType.Ball
			collision.Size = Vector3.new(1,1,1) * Configurations.BlastRadius.Value * 2
			collision.Parent = game.Workspace
			collision.CanCollide = true
			local hitPlayers = {}
			local hitParts = collision:GetTouchingParts()
			collision:Destroy()
			local player = Players:GetPlayerFromCharacter(otherPart.Parent)
			if player then DirectHitPlayer:FireServer(player.userId) end
			for _, hitPart in ipairs(hitParts) do
				local player = Players:GetPlayerFromCharacter(hitPart.Parent)
				if player and not hitPlayers[tostring(player.userId)] then hitPlayers[tostring(player.userId)] = true end
			end
			HitPlayer:FireServer(hitPlayers)
		end
	end)
end

return RocketManager
