local Y=game.Players.LocalPlayer local n=script.Parent.Parent local o=n:WaitForChild("\072\105\116\080\108\097\121\101\114\115")local C=n:WaitForChild("\068\105\114\101\099\116\072\105\116\080\108\097\121\101\114")local b=n.Configuration function RocketManager.BindRocketEvents(M,v)local X=false v.PrimaryPart.Touched:connect(function(M)if not M:IsDescendantOf(Y.Character)and not X then X=true v.PrimaryPart.LocalTransparencyModifier=1 n.RocketHit:FireServer(v,v.PrimaryPart.Position)local Y=Instance.new("\080\097\114\116")Y.Anchored=true Y.CanCollide=false Y.Position=v.PrimaryPart.Position Y.FormFactor=Enum.FormFactor.Custom Y.Shape=Enum.PartType.Ball Y.Size=(Vector3.new(1,1,1)*b.BlastRadius.Value)*2 Y.Parent=game.Workspace Y.CanCollide=true local f={}local I=Y:GetTouchingParts()Y:Destroy()local y=Players:GetPlayerFromCharacter(M.Parent)if y then C:FireServer(y.userId)end for Y,n in ipairs(I)do local o=Players:GetPlayerFromCharacter(n.Parent)if o and not f[tostring(o.userId)]then f[tostring(o.userId)]=true end end o:FireServer(f)end end)end return RocketManager
-- Local Variables
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
