local function G()local G=MyPlayer.Character if Tool.Enabled and(G and(G:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")and G.Humanoid.Health>0))then Tool.Enabled=false local G=MouseLoc:InvokeClient(MyPlayer)local a=Rocket:Clone()DebrisService:AddItem(a,30)a.BrickColor=MyPlayer.TeamColor local t=(ToolHandle.CFrame*CFrame.new(5,0,0)).p a.CFrame=CFrame.new(t,G)a.CanQuery=false a.Parent=workspace task.spawn(function()while a.Parent==workspace and task.wait(.0)do local G=MouseLoc:InvokeClient(MyPlayer)print(G)a.CFrame=CFrame.lookAt(a.Position,G)a.CFrame*=CFrame.new(0,0,-ROCKET_SPEED)end end)wait(RELOAD_TIME)Tool.Enabled=true end end function OnEquipped()MyPlayer=PlayersService:GetPlayerFromCharacter(Tool.Parent)end


local function OnActivated()
	local myModel = MyPlayer.Character
	if Tool.Enabled and myModel and myModel:FindFirstChildOfClass("Humanoid") and myModel.Humanoid.Health > 0 then
		Tool.Enabled = false
		local Pos = MouseLoc:InvokeClient(MyPlayer)
		-- Create a clone of Rocket and set its color
		local rocketClone = Rocket:Clone()
		DebrisService:AddItem(rocketClone, 30)
		rocketClone.BrickColor = MyPlayer.TeamColor

		-- Position the rocket clone and launch!
		local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
		rocketClone.CFrame = CFrame.new(spawnPosition, Pos) --NOTE: This must be done before assigning Parent
		rocketClone.CanQuery =false
		rocketClone.Parent = workspace
		task.spawn(function()
			while rocketClone.Parent == workspace and task.wait(.0) do
				local Pos = MouseLoc:InvokeClient(MyPlayer)
				print(Pos)
				rocketClone.CFrame = CFrame.lookAt(rocketClone.Position,Pos)
				rocketClone.CFrame *= CFrame.new(0,0,-ROCKET_SPEED)
			end
		end)
		
		wait(RELOAD_TIME)
		
		Tool.Enabled = true
	end
end

function OnEquipped()
	MyPlayer = PlayersService:GetPlayerFromCharacter(Tool.Parent)
end
